Maven : Eclipse Integration

In previous post we saw how to use maven from command line, but we will most likely use an IDE for our development. Both maven and eclipse has plugins for each other. Lets take the example from our previous post and convert it into an eclipse project. Lets take a look at project structure:


In order Eclipse to understand above web project, we need to convert this by

$mvn eclipse:eclipse

Here we are using eclipse plugin. This is similar to our tomcat plugin we used earlier, but this we do not have to mention in pom.xml as we want the default implementation. for tomcat we needed to change some configuration so we added that in pom.xml


Notice the addition of classpath etc which is required by eclipse. Now import this in eclipse.

Import > General > Existing Projects into Workspace


You can choose the copy to workspace option if you want to have a local copy in eclipse workspace. If unchecked, all alteration from eclipse will be made on the original directory. In some cases there may be path issue for which you have to create a variable pointing to the m2 repository directory.


Now in order to run maven commands from eclipse, we need to have maven plugin in eclipse. Install the plugin:


To run maven commands from eclipse right click on ‘pom.xml’ and select accordingly:




You can make a new maven project from eclipse itself using the gui provided by it which is pretty self explanatory.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: