Saturday, August 14, 2010

Maven sucks like hell

IMHO Maven is CRAP, the underlying concept is good but the implementation is repulsive, with all the xml to be handcrafted. It should not be hard to create a DSL and a nice IDE, yet people get carried away by this XML junk and we spit blood juggling with confusing documentation and endless xml snippets.

As here says:
"All of this can make using maven very time consuming and frustrating. I do think that maven is a good project but that it could be great if managed correctly."
Simply said, my head and Maven  Designer head are made in incompatible ways.

Incidentally at office they had endless discussions on Maven vs Ant. I am not interested in choosing between a hard place and a rock: I want a modern tool to address my needs and get my stuff done in a breeze.

Whoever asserts that you should build a complex project modeling or a complex procedural deployment script based on XML is simply UNHEALTHY.

I have seen Maven "experts" struggle for hours even to get the basic done, and still their stuff breaks again and again. It's like if in Eclipse or NetBeans it would take me one day to create an empty EJB project.

Creating the structure for a EAR with a ejb-client, a war, a ejb module and dependencies from other Java projects (jar) should be a matter of a few clicks or a command.... in Maven the maven-ear-plugin is very poorly designed, I have surfed for hours and searched several book for a clear example, in vain. And everything is a matter of copying and pasting XML.

There is a decent plugin for Eclipse, with an extensive reference book:

This plugin seems to make Maven use POSSIBLE for a regular human being, without incurring in several nervous breakdowns. In fact, even this plugin has been designed without a proper specialized wizard for each project topology, so you are left alone to juggle in a myriad of options without a clear path to follow.

Maven, even with the Eclipse plugin, is for the maven, not for the accidental user. There is nothing like 1-2-3-easy, unless you do the really basic stuff.

I am simply trying to create a structure for an EAR with an EJB and a WAR and some dependencies from some Java projects.
With a NORMAL tool I would assume I can get it done with:

create EAR myEAR including WAR myWar, EJB myEJB depends on JAR myJAR1, myJAR2

They give you only this example, and it's your problem to recreate the entire directory structure.

Instead of using and abusing XML, they should have designed a Domain Specific Language and integrate in Groovy.

Here more on why Maven sucks.

Excellent tutorial:

+X turns on debugger
-e enables exception tracing

In c:/apps/maven/conf/settings.xml you find several interesting properties, such as the local-repository and the proxy.

mvn --version

mvn archetype:generate -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

cd my-app/
less pom.xml
mvn package
java -cp target/my-app-1.0-SNAPSHOT.jar
ls target/classes/
mvn test
mvn test-compile

ls ~/.m2/repository

to build offline:
mvn -o package

mvn eclipse:eclipse


mvn process-resources


This is how to create an ear:


Luciano said...

I have been using succesfully Gradle on a large, complex project in the last 8 months and there is no come back.
Maven was never an option because of its excessive complexity and rigidness.
Gradle is a Groovy DSL for building software. Dependency management is based on Ivy and it is compatible with Maven repos.

vernetto said...

ha, in fact we discover that Maven 3 is going to be very much Groovy-like:

this *MIGHT* turn Maven into something usable by regular human beings.

vernetto said...

Maven 3.0 is showing some good will to come out of the darkness of the Middle Ages and open to project modeling formats which are not XML:

they talk about Polyglot Maven! So finally they do the right thing after they have tried everything else... Welcome to the new World ...

Unknown said...

I had to work with the maven3 and I share the opinion of the author. If you have a non-trivial multi-model Project differs from the pattern, the configuration of maven turn to hell. Maven looks good until you go to a standard well-known way. But one step to the side and idioms of maven no longer work. If you have any special features, this tool is not suitable. Maven is too relies on idioms not common mechanisms. Many things are implied, hardcoded and it's difficult to change.