Wednesday, February 3, 2010

maven quirks

Things that are problematic with maven:

dependency management
correctly configured maven offers to automagically handles the dependency management of your project - after defining your projects dependencies maven will fetch them from the repository (internet) and install them in your local repository.
So far so good - the dependencies themselves usually also have dependencies and maven will fetch all of them for you.
The problems start when there dependency conflicts or references to direct implementations of e.g. loggers etc. Sometimes libraries depend on a different build of dependencies - like 1.5 builds vs 1.6 builds or a nodeps build vs a build with several smaller jar files.
To resolve that I specified exclusions and specific version imports for the dependencies in question. Netbeans offers a nice dependency viewer which even offers to view and resolve conflicts with just a mouseclick.

memory
as maven usually starts quite many task directly from the same java vm (there are exceptions which fork the java vm) you may have to be careful to offer maven enough java heap space for the build.
It is the same for ant but it should be mentioned.
(This of course depends on the size of the project)

maven

I switched from ant to maven quite a while ago and after sorting out some quirks and problems it is working nicely.
One thing that's immediately evident ist - as soon as you use maven your requirements change - as there are so many possibilities - like generating project documentation, code metrics and so on.
There are also so many interesting plugins/mojos available that soon you will like and use.
The maven integration in netbeans(6.8) is also great and even superior to the ant project system in my opinion because of the higher feature set which is provided by maven out of the box.
There are definitly things to sort out when using maven - and it is far from perfect but i think it offers a nice standardized way to organize and build projects with the possibilty to add plugins easily.