Marc, himself, his blogs, and you reading them.

August 04, 2006
Taming maven-2, part 1.
Or as Howard was putting it; 'appeasing the petty God'.  Matter of fact, the maven team selected his quote to be this week's guiding 'topic' of the #maven irc channel.

Entering maven-2 land is like coming home after the long and winding travel maven-1 was about.  Yeah sure, there is some laundry you badly need to do. But your custom build cutlery is getting a dedicated spot on the cupboard as opposed to getting wrapped up and displaced all the time.  If you're the kind that will never leave ant, that's just fine, but if you ever waged into maven-1, you really should schedule switching to maven-2.

(Although just like maven-1, this release has some rough-edges feeling, I just have my hopes up this is a good sign of release early-and-often that will eventually go away)

Doing injustice to the smooth 80% I'm only adding these simple lists: (anyway, the actual recommendation here is just go and see for yourself)

There is plenty docs already out there (always room for more). Some maven sources that inspired me:
  1. Java posse interview with Brett Porter. (#070)
  2. Better Builds with maven. (Mergere's book)
  3. Almost all of Maven's mini-guides (from this list
  4. helpful hands at the #maven channel
  5. loads of lucky searches at Google
Trick's I've learned already:
  1. check the effective-pom
    mvn help:effective-pom | less
  2. let plug-ins describe themselves
    mvn help:describe -DgroupId=org.apache.maven.plugin -DartifactId=maven-compiler-plugin -Dfull -Dmojo=testCompile
  3. use the -X to get a grasp of the life-cycle steps, and how it all works (pipe through less to read at your own pace)
  4. write those MOJO's, no really, write them!
  5. use the maven2 extension for eclipse, and don't think so fast you should file a bug
  6. don't try to be smarter then the tool (specially: stop thinking pre-goal/post-goal)
Which brings me to the 20% of 'Making Sacrifices on the Maven-2 Altar'.  
[random sequencing of goals]
The immediate advice I got on the channel when opening with "I'm looking for the maven-2 equivalent of the maven-1 'pre-goal'" was this clear "don't hold your breath".

Here is what seems to BE: The order of goals tied to one and the same life-cycle phase are executed
  1. AFTER the one that is tied to the life-cycle for that particular packaging type 
  2. and then in no particular order,
    (although it looks like it follows the order they are declared in the effective-pom)
Note that the order in which you declare plug-ins in the pom is irrelevant!  (Which makes sense if you grasp that changing the plugin-order in the parent pom, could affect the effective order of any child pom.)

So, you are not to expect any ordering between multiple goals tied to the same phase.  Which basically boils down to: we're left over to the goodwill of maven-2 to define enough phases to tie your goals to.

Note: above is unless you are willing to define your own artifact and life-cycle, which might very well the place I end up for other reasons after all. (There afaiu you can define your own phases as you please.) 

[integration tests]

After quite some attempts I'm just giving up on trying to combine regular junit tests and integration tests in one and the same module.  

The fact that both have different life-cycles assigned to them kept leading me to believe that I should be able to combine them in one project easily, but it turned out there was no easy way for me to get the correct ones executed in the different phases.

Well, so far for my first weeks of maven-2.  As they say: "it ain't over till the fat lady sings", and I sure have some more maven-laundry to be done.  If anybody has some advise on the above just drop me a note. # Posted by mpo at 02:35 PM | Comments (0) | TrackBack (0)