Import eclipse project as Java EE
I have created a Java EE project using maven and would like to import it as a Java EE project (ie: auto have the libs jars added to the classpath, tomcat jars to classpath, etc). How can I ch开发者_C百科ange an existing project to a Java EE project?
Both the maven-eclipse-plugin and the Eclipse M2Eclipse plugin can handle this use case and make Eclipse treat your war/ejb/ear projects as WTP projects.
For the maven-eclipse-plugin, check the WTP support page (you can of course add this parameter to the <configuration>
element of the plugin).
For the M2Eclipse plugin, make sure you also install the Maven Integration for WTP (which is optional) or you won't get WTP support. Note that for a war
module, the plugin will set the Dynamic Web Module facet version on the basis of the version of web.xml
(2.3, 2.4, 2.5) and the version can't be changed once the project has been imported. So make sure to have the "right" web.xml
before the import (or delete the project from the workspace, change the web.xml
and re-import the project).
Use the m2eclipse plugin. It will tell Eclipse which JARs to include and you can manage all your dependencies in the pom.xml
.
精彩评论