Maven Survival Guide

 Hi Internet,
I am Giovanni `Daitan` Giorgi (you can find my fingerprint from 1993 emails out of there)
and I am a IT wizard.
I can code Java EJBs with one hand, and build a cakephp-enabled application with the other, while saying you how to set up your amazon aws in zero time.
And I can code real 6502  assembly in binary

But…I found maven difficult to master… (every hero as a Achilles’ heel..)

Maven is danger like kryptonite, you know.

So I decided to help you, poor developer,  to avoid asking me maven support at all

 

Step1: Download Maven 3.x or 2.x and avoid using it directly

AppFuse has done a great work providing a ready-to-use set of archetypes.

Then, the following turbo complex command will make your way to home…
[bash]mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-light-spring-archetype -DarchetypeVersion=2.1.0 -DgroupId=it.isp.examples -DartifactId=may -DarchetypeRepository=http://oss.sonatype.org/content/repositories/appfuse
cd may
# Ensure no config will bother you:
mvn eclipse:clean
mvn eclipse:eclipse -DdownloadSources -DdownloadJavadocs
mvn test jetty:run-war -Dsurefire.useFile=false[/bash]
 

Step2: Install M2Eclipse but do not use it very much

m2eclipse is not so good in my humble (but powerful) opinion. Install it but use a maven command console to compile and do the hard work.

 

Step3: Take a Mojto

If you are drunk, maven works better, for sure. Believe me. Take at least a beer

 

Lastly

On 2013 I have started evaluating Gradle, which can try to pull in its world taking away maven3. Gradle sometime spots similar maven problems (like does not understanding a war must be packaged like a war and not like a jar!) but it has at least an easier to read configuration script.