This is my blog in English, about the stuff I do for a living, and about the stuff I read about the stuff I do for a living - when I am not working.

Wednesday, March 4, 2009

Maven with Eclipse, not anymore...

I am a happier person now. I've disabled Maven + Eclipse integration in my current Eclipse installation and I went a little bit further - I haven't installed the Maven plugin in my current Eclipse installation.

How is that possible? Here is the answer: http://maven.apache.org/plugins/maven-dependency-plugin/

I associated the plugin execution with the phase "validate" in Maven, so every time I run the targets "validate" or "generate-sources" (or with the compilation targets "compile" or "build"), all the maven dependencies are copied to an output folder inside the "target" folder. After that, I can add these copied dependencies statically to the Eclipse project from Eclipse. And here you go, no Maven + Eclipse integration is needed anymore.

Advantages:

. Eclipse works better - the ammount of annoyance generated by eclipse is directly related to the number of plugins that are installed on it;
. It's common that all the versions of a dependency are include in the classpath when running a project with Maven integration enabled - for example, commons-lang-2.1 and commons-lang-2.4. When the dependencies are copied to the target folder, only the resolved dependencies are copied (in that case, it probably will be commons-lang-2.4);
. Less heuristic, more deterministic - things magically start happening in the way there are supposed to.

Disadvantages:

. You have to remember to invoke the "mvn validate" or "mvn generate-sources" on the command-line before trying to compile your project inside Eclipse.

So far, it's paying off. I have way less bugs to worry about and a lot of "down-time" was saved after I started using Eclipse without Maven.

No comments:

Post a Comment