Amazon Links

Friday, April 11, 2008

Making your Project IDE Independent

Every wondered about getting to build your project within ide and still maintain an single build system.

As a java developer, you would always use some ide like eclipse, intellij, netbeans...etc. And still would like to have an ability to build at command line. Most people have started thinking of 'ant' by now. But ant doesn't solve all the problem. Ant based build systems have the following problems.
  1. Ant build would not coexist with ide incremental build support
  2. Dependency in ant cannot be imported into ide.
Let us now welcome maven, I am not going to fight about the difference of ant and Maven. But just look at how good the interaction of Maven is with the ide. For the sack of illustration, I would look at my favourite ide, eclipse

We have two important eclipse plugin for maven available :-
  1. Maven eclipse IDE plugin
  2. Eclipse Maven Plugin (Google Summer contest)

Maven IDE Plugin M2Eclipse

This is a mature stable plugin with basic Maven support. This provides basic integration for Maven and allows uses to run maven targets from eclipse

Google Maven Plugin. q4e

This Maven Plugin was originally started as a google summer code project and is now adopted by Eclipe foundation. This would be the foundation for official eclipse plugin for maven. This is still under quite a lot of active development, but still contain quite rich interaction of Maven. The last release was 0.5.0 which contains quite a few good features. This is worth a look once.


Coming back to eclipse Maven interaction, what makes maven an excellent tools is that maven seamlessly integrates into the ide. An Maven based build system can run from command line and using the ide without any major change.

The Maven dependency are seamlessly added to eclipse project, and hence the enduser need to only define its maven dependency, without touching eclipse dependency definition. As a result, when the project is build from command line, the dependencies would continue to be present. This single point configuration of dependency makes development and build management exceptionally easy.

Important distinction that i want to make is using maven goal eclipse:eclipse for building eclipse project definition from maven pom.xml file. This approach doesn't create since point configuration, since you would modify eclipse project files at some point and that would lead to pom.xml and project files getting out of sync.


Maven plugins are available for major ides, so same can be repeated for other environments.
Try it your self and see the difference.