M2Eclipse, Maven, Eclipse WTP and Managing Java Web Project with dependencies

In last article, I talked about using Eclipse plug-in provided by Maven and using it to manage the Java project dependencies. As discussed, it is quite handy and a organized way to manage the dependencies not only at the build time but while developing applications as well. [Remember developers don’t have to play treasure hunt to find out which version of Jar works with which release.]

While the application can manage the dependencies well for non-web applications, the Eclipse WTP plug-in simply fails to recognise Maven powered web applications (Note that you can build web application using “war” packaging on command line, but Eclipse WTP simply ignores such project.)

But to answer this problem, sonatype has created an additional plug-in which can be downloaded from
Once you will add this site to Eclipse update manager, you will find list of options available in Update Manager.

Maven Extras Plug-in
Maven Extras Plug-in

Install both the features as listed in above image and restart the Eclipse.

Now create a “Project” which has no nature or build profile attached and then create following structure.

Sample Eclipse Project
Sample Eclipse Project

Also create a Maven Script “pom.xml” file which should contain packaging tag with value as “war”. Please refer following sample POM script created by me for above project.


Note that the compiler configuration shown above is purely optional, but to make sure which version of Java is used by the project, It is recommended to configure one.
Then right click on your project and from the context menu select Maven > Enable Dependency Management. Your project should now be configured as web project by Maven plug-in and you should see a changed with of project as

Maven powered web project
Maven powered web project

Now go to “Servers” view and select your preferred Java Server and then add the Project to deployment. Once the project is added to the server, you should see that all your dependencies are exported to WEB-INF/lib folder, when server gets started.

By Carbon Rider

Hi this is Yogesh, welcome to my world. Being passionate about learning new technologies and building frameworks, I end up spending most of my time in front of computer. But over last few months, I realised apart from being good coder and designer (Yes I am) I have something hidden in me. And thats called ART.

Leave a Reply