Real Ultimate Programming

The Home for People Who Like to Flip Out and Write Code

Cd Maven2 && Mvn Archetype:create Fail-whale

I like the premise behind Maven, I really do. In the real world, though, Maven is an attractive nuisance: it lures developers in with its promises of an easier, consistent build process and quality project documentation, then ambushes them with constant breakage.

My latest brush with Maven breakage came this weekend when I tried to use the Archetype plugin. The archetype plugin creates a new project from an existing template. Typical archetypes do things like create the necessary directory structure and download dependencies, and some go as far as creating source code for a functional skeleton, e.g., the AppFuse Archetypes.

Sounds great, right? Well, it would be if it worked. Instead, when I tried to use the archetype plugin, it started downloading dependencies and broke. It turns out, they released my version of the plugin with dependencies that don’t exist in the central repositories (specifically, commons-collections version 3.2 and commons-lang version 2.1). This is fairly widespread among third- party maven projects, but I didn’t expect it from something as central as the archetype plugin.

I was irritated, but I wasn’t ready to give up. Luckily for me (I thought), the error message suggested a workaround: manual installation of the dependency into your local repository. It even provided instructions:

mvn install:install-file -DgroupId=commons-lang -DartifactId=commons-lang -Dversion=2.1 -Dpackaging=jar -Dfile=/path/to/file and mvn install:install- file -DgroupId=commons-collections -DartifactId=commons-collections -Dversion=3.2 -Dpackaging=jar -Dfile=/path/to/file.

The straw that programmer’s back came when I tried to follow those directions.

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Error installing artifact 'commons-collections:commons-collections:jar': Error installing artifact: /Users/hankgay/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar (No such file or directory)

At this point, I didn’t have the energy to dig any deeper, but that error message is monumentally frustrating. Of course /Users/hankgay/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar doesn’t exist; the whole point of the command was to create it!

The moral of the story? Maven is the sort of tool that only a masochist could love.


I really wanted to use the maven-archetype-webapp, so I started futzing about with those dependencies again. Eventually I fixed the problem by manually mirroring the proper versions from ibiblio. I hope the Maven team works on this soon, because these are some pretty absurd lengths to go to make something work that comes in the box.

Back to flippin’ out…