Maven and Eclipse Issues

I use Maven for almost all Java projects I work in. I prefer using Netbeans with Maven as it has solid integration with Maven and I find it a hassle free approach of working with Maven without cluttering up your project with ‘special’ project files. However I have found out that Eclipse cannot be ignored as it has much faster performance and it needs lesser memory than Netbeans. So here are some tricks to work around the build issues I have faced with Eclipse when combined by Maven. The usual issue I faced was that I could build my project from console but I saw lots of build issues when building from inside Eclipse and lot of build errors were logged inside Eclipse ‘Problem’ view.

Refresh Project On pom.xml change
If you have changed anything in the pom.xml you should refresh your Eclipse project. It is possible Eclipse will pick up your changes from pom.xml and resolve any build / dependency issue in this step itself.

Re-generate Eclipse Project Files
If you have added a dependency in pom.xml you should ensure that the following commands are executed to regenerate the Eclipse project configuration files.

mvn eclipse:clean
This will delete the .project, .classpath and .settings folder of Eclipse.

mvn eclipse:eclipse
This will regenerate the .project, .classpath and .settings folder for your project.

Once you execute the above commands go back to your Eclipse project and refresh your project by right clicking on the project and clicking on refresh in the context menu or by pressing the ‘F5’ key after selecting the project.

In my experience so far Eclipse is able to resolve all dependence / build issue and you should have a trouble free coding experience now.

One thought on “Maven and Eclipse Issues

  1. Pingback: Maven and Eclipse Issues | Thoughts of Abhinav Anand | Maven

Leave a Reply

Your email address will not be published. Required fields are marked *