如何解决tomcat服务器不能选择项目问题

      首先我自己在平时导入项目的时候遇到过几次,每次都话费很长的时间。现在有机会把解决方法给大家分享下。

   我的情况是:导入项目后,tomcat添加项目时没有该项目选择。

   据网上搜索:这是因为该项目不是web项目。

解决办法:选择该项目,右键--properties---myEclipse--Project Facets.  看到如下界面,勾选即可。然后再用tomcat选择项目即可。

 

 

 

 

 

如果是没有deployment assembly.可以如下操作。

 

2. 经过1的project转换后,应该能够看到Deployment Assembly出现了,但如果还么出现,很有可能在Eclipse中Deployment Assembly被disable了,那么我们需要做的就是将Deployment Assembly选项enable。

在项目所在的工作区间有一个.project文件,打开该文件增加如下这一行用于enable Deployment Assembly属性。

<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>

如下面的.project file.

Xml代码 

 收藏代码

  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <projectDescription>  
  3.     <name>shortbread</name>  
  4.     <comment></comment>  
  5.     <projects>  
  6.     </projects>  
  7.     <buildSpec>  
  8.         <buildCommand>  
  9.             <name>org.eclipse.jdt.core.javabuilder</name>  
  10.             <arguments>  
  11.             </arguments>  
  12.         </buildCommand>  
  13.         <buildCommand>  
  14.             <name>org.eclipse.wst.common.project.facet.core.builder</name>  
  15.             <arguments>  
  16.             </arguments>  
  17.         </buildCommand>  
  18.         <buildCommand>  
  19.             <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>  
  20.             <arguments>  
  21.             </arguments>  
  22.         </buildCommand>  
  23.         <buildCommand>  
  24.             <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>  
  25.             <arguments>  
  26.             </arguments>  
  27.         </buildCommand>  
  28.         <buildCommand>  
  29.             <name>org.eclipse.m2e.core.maven2Builder</name>  
  30.             <arguments>  
  31.             </arguments>  
  32.         </buildCommand>  
  33.     </buildSpec>  
  34.     <natures>  
  35.         <nature>org.eclipse.jdt.core.javanature</nature>  
  36.         <nature>org.eclipse.m2e.core.maven2Nature</nature>  
  37.         <nature>org.eclipse.wst.common.project.facet.core.nature</nature>  
  38.         <nature>com.google.gwt.eclipse.core.gwtNature</nature>  
  39.       <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>  
  40.     </natures>  
  41. </projectDescription>  

 然后重启Eclipse, 就可在Project的properties中看到Deployment Assembly选项了。