eclipse下将java工程变成web工程

今天将之前的一个老web工程导入到eclipse,发现变成了java工程无法发布到tomcat上去。感觉挺奇怪的,不知道为什么会这样。查了下资料,就是到此项目所在的文件下的根路径里面找到.project文件并打开,找到    标签

   
        com.genuitec.eclipse.ast.deploy.core.deploymentnature
        com.genuitec.eclipse.hibernate.hibernatenature
        com.genuitec.eclipse.springframework.springnature
        com.genuitec.eclipse.j2eedt.core.webnature
        org.eclipse.jdt.core.javanature
        org.eclipse.wst.jsdt.core.jsNature
        com.genuitec.eclipse.cross.easystruts.eclipse.easystrutsnature
    

添加了    org.eclipse.jem.workbench.JavaEMFNature,然后刷新下工程。

然后在Eclipse里选中工程-->右键-->properties-->Project Facets 选中“Dynamic Web Module 2.5版本”、和Java两项前面的复选框,然后点Apply--->Save ,最后刷新项目就变成了Web工程了

 

然后就可以再tomcat上找到这个项目了,发现要部署的时候,又提示Tomcat version 6.0 only supports J2EE 1.2, 1.3, 1.4, and Java EE 5 Web modules,解决办法就是找到该项目->.settings 文件夹->org.eclipse.wst.common.project.facet.core.xml,



 
 
 

把上面中  版本改低点,我把它改成2.5,然后刷新下项目,发现还是出现这样问题,然后close下项目,再打开,就解决啦。


参考自:http://blog.csdn.net/zelda002/article/details/7651931,

http://blog.csdn.net/lpz283929516/article/details/7241797。



你可能感兴趣的:(eclipse下将java工程变成web工程)