[b]Converting a Java project to a Dynamic Web project in Eclipse (基于WTP,通过Project Facets)[/b]
What's WTP?
[url]http://www.eclipse.org/projects/project_summary.php?projectid=webtools[/url][quote]The Eclipse Web Tools Platform (WTP) project extends the Eclipse platform with tools for developing Web and Java EE applications. It includes source and graphical editors for a variety of languages, wizards and built-in applications to simplify development, and tools and APIs to support deploying, running, and testing apps.[/quote]
Converting a Java project to a Dynamic Web project in Eclipse:
[b][url]http://greatwebguy.com/programming/eclipse/converting-a-java-project-to-a-dynamic-web-project-in-eclipse/[/url][/b]
Eclipse – Project Facets:
[b][url]http://www.beilers.com/2009/05/eclipse-project-facets/[/url][/b]
[b]Maven(m2eclipse插件) + WTP + tomcat:[/b]
如果是使用m2eclipse导入的maven项目,则你如果觉得手动往local tomcat - webapps里扔war包的过程太麻烦,想在eclipse中的tomcat上做开发部署,肯定是需要为该web项目添加wtp支持的。除了按上面的步骤为该web项目添加project facets外,还需要注意要将该web项目的Maven Dependencies也添加到 部署/发布 路径里去,具体做法:
Maven, Eclipse and Tomcat:
[url]http://vijaypm.blogspot.com/2010/12/maven-eclipse-and-tomcat.html[/url]
Tomcat & Spring Web - Class Not Found Exception org.springframework.web.context.ContextLoaderListener:
[b][url]http://stackoverflow.com/questions/6322711/tomcat-spring-web-class-not-found-exception-org-springframework-web-context[/url][/b]
Maven project in eclipse - deployment assembly fails build[b](Invalid classpath publish export Project entries not supported):
[url]http://stackoverflow.com/questions/6799135/maven-project-in-eclipse-deployment-assembly-fails-build[/url][/b]
将MyEclipse项目导入到Eclipse中:
[url]http://todaydiy.blog.163.com/blog/static/104189687201021035312604/[/url][quote]1.请首先确保你的eclipse是javaee版本的,或者已经安装看wtp插件
2.然后修改eclipse工程下的.project文件:
3.刷新项目,项目->右击->Properties->Project Facets->Modify Project,选择Java和Dynamic Web Module
配置Context Root 和Content Directory 以及源码路径。
[/quote]
A Error:
[quote]Java compiler level does not match the version of the installed Java project facet[/quote]解决:
[url]http://www.eclipsezone.com/eclipse/forums/t80428.html[/url]
[quote][b][color=red][size=x-large]A wtp project is composed of multiple units of functionality (known as facets)[/size][/color][/b].
Take a look at Project Properties -> Project Facets panel. The java facet version needs to always match the java compiler compliance level.
[b][color=red]The best way to change java level is to use the Project Facets properties panel as that will update both places at the same time[/color][/b].
Alternatively, when you get the error that you are referring to, there are quick fixes available to resolve it.
[/quote]
What's WTP?
[url]http://www.eclipse.org/projects/project_summary.php?projectid=webtools[/url][quote]The Eclipse Web Tools Platform (WTP) project extends the Eclipse platform with tools for developing Web and Java EE applications. It includes source and graphical editors for a variety of languages, wizards and built-in applications to simplify development, and tools and APIs to support deploying, running, and testing apps.[/quote]
Converting a Java project to a Dynamic Web project in Eclipse:
[b][url]http://greatwebguy.com/programming/eclipse/converting-a-java-project-to-a-dynamic-web-project-in-eclipse/[/url][/b]
Eclipse – Project Facets:
[b][url]http://www.beilers.com/2009/05/eclipse-project-facets/[/url][/b]
[b]Maven(m2eclipse插件) + WTP + tomcat:[/b]
如果是使用m2eclipse导入的maven项目,则你如果觉得手动往local tomcat - webapps里扔war包的过程太麻烦,想在eclipse中的tomcat上做开发部署,肯定是需要为该web项目添加wtp支持的。除了按上面的步骤为该web项目添加project facets外,还需要注意要将该web项目的Maven Dependencies也添加到 部署/发布 路径里去,具体做法:
右键web项目 -> Properties -> Deployment Assembly -> Add -> Java Build Path Entries -> 点选Maven Dependencies并确定。
另外,如果该web项目的Maven Dependencies中有对其他项目的依赖,比如,多个maven modules的情况下,则需要将这几个依赖的项目也添加进去,跟上面的步骤基本相同:
右键web项目 -> Properties -> Deployment Assembly -> Add -> Project -> 点选依赖的项目并确定。
参考资料:
Maven, Eclipse and Tomcat:
[url]http://vijaypm.blogspot.com/2010/12/maven-eclipse-and-tomcat.html[/url]
Tomcat & Spring Web - Class Not Found Exception org.springframework.web.context.ContextLoaderListener:
[b][url]http://stackoverflow.com/questions/6322711/tomcat-spring-web-class-not-found-exception-org-springframework-web-context[/url][/b]
Maven project in eclipse - deployment assembly fails build[b](Invalid classpath publish export Project entries not supported):
[url]http://stackoverflow.com/questions/6799135/maven-project-in-eclipse-deployment-assembly-fails-build[/url][/b]
将MyEclipse项目导入到Eclipse中:
[url]http://todaydiy.blog.163.com/blog/static/104189687201021035312604/[/url][quote]1.请首先确保你的eclipse是javaee版本的,或者已经安装看wtp插件
2.然后修改eclipse工程下的.project文件:
<!--在 <natures></natures>中加入-->
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<!--在 <buildSpec></buildSpec>中加入-->
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
3.刷新项目,项目->右击->Properties->Project Facets->Modify Project,选择Java和Dynamic Web Module
配置Context Root 和Content Directory 以及源码路径。
[/quote]
A Error:
[quote]Java compiler level does not match the version of the installed Java project facet[/quote]解决:
[url]http://www.eclipsezone.com/eclipse/forums/t80428.html[/url]
[quote][b][color=red][size=x-large]A wtp project is composed of multiple units of functionality (known as facets)[/size][/color][/b].
Take a look at Project Properties -> Project Facets panel. The java facet version needs to always match the java compiler compliance level.
[b][color=red]The best way to change java level is to use the Project Facets properties panel as that will update both places at the same time[/color][/b].
Alternatively, when you get the error that you are referring to, there are quick fixes available to resolve it.
[/quote]