Add Eclipse WTP features to Maven web project

By a “Maven web project” I mean a Maven project which has War packaging instead of Jar (in pom.xml: <project><packaging>war</packaging></project>). When importing such projects, Eclipse may not be able to figure out that the produced War artifact may be deployed on a server.

Maven may configure your Eclipse project to support WTP:

mvn -Dwtpversion=2.0 eclipse:eclipse

This goal can also be run inside Eclipse when you right-click the project and then select: Run as -> Maven build… As goal you type in eclipse:eclipse and add a new line in the parameter table where the parameter name is wtpversion and the value is 2.0.

Running the eclipse:eclipse goal for an existing project does not affect any unrelated settings in you project.

Links

  • [1] Maven eclipse plugin: WTP Support

Leave a Reply