Make Maven Project visible to Eclipse WTP

If you are like me and taking advantage of Eclipse WTP to keep everything close together and deploy your web applications inside of Eclipse IDE then chances are that you might already have considered doing the same for a project with a Maven flavor.

Sonatype’s M2Eclipse plugin provides very nice interoperability for Maven related actions inside of the Eclipse platform, from creation or materialization of Maven projects to source/documentation downloading options, special visualization of the POM file or even repository and indexing functionalities.

Therefore having in the POM:

<packaging>war</packaging>

is enough for Maven’s magic:

mvn package

to create the war file. All good up until now.

Say for instance we now want to deploy this into Tomcat from inside Eclipse WTP tooling platform. In case the web module is NOT showing under the “Add and Remove” section of servers/new servers in Eclipse here’s what you need to do if you don’t want to spend hours of frustration:

  • This is most likely happening because you are missing the Maven integration with WTP, something that can be installed as a plugin from the M2Eclipse Extras Eclipse compatible url update site.
  • If even after the above the module is still not visible, it’s because the Eclipse Maven project you are working on was initially created as a non-Maven project and you’ve added the Enable Dependency Management option from the M2Eclipse plugin. In that case, create a New Maven Project or Import an Existing Maven Project and that should hopefully do the trick.