Category Archives: Maven

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.

Production helper utility for Java team

I have been thinking about going through some of these tools to get more productive in deploying / delivering Java based web apps to the team:

Drop Jar is a helpful tool to share jar files.

Drop Wizard is a helpful tool for delivering production read jar files.

Spring Boot allows developers to create web apps easily using convention over configuration.

Shade Plugin allows a Maven based build to overcome duplicate / incompatible versions of libraries. If you have been bitten by incompatible log files you know what I mean.

Eclipse Maven – Download Sources and JavaDoc

Eclipse Maven integration has improved quite a bit and I find it somewhat comparable to the excellent Maven integration provided by Netbeans. I recently required to debug third party jars and I needed their sources for this purpose and as a general practice I always download the javadoc for any third party library I use. This is easily done in Eclipse using the following approach.

Do it per project

Eclipse Maven Context Menu for Project

Eclipse Maven Context Menu for Project

Do it for all projects

Eclipse Maven Properties Dialog

Eclipse Maven Properties Dialog