Using Maven2 - For Beginners

Posted by U.S. Wickramasighe | Posted in , , , , , , , | Posted on Sunday, December 07, 2008

Maven2 is completely new source code building System. Unlike previous types of builders (ie:- Ant, Make) Maven2 is not task oriented..In Abstract sense , for Maven2 you have 2 specify 'what' not 'where' / 'how to' in building your source code.

Pom.xml is the descriptor file for Maven2 where you can specify ,

  • code dependecies
  • Bundle information (Version, Artifact Id ,Group Id..)
  • OSGi related stuff
  • plugin information (compiling,OSgi,Ant,etc )
Maven2 has a local central repository (ie:- in Linux this is ~/.m2 directory) and also you can specify remote repositories as well incase to download the dependent code if not available in local one.

'Pom.xml' descriptors canbe grouped hierachically when necessary to make your build more efficient and reliable . This is done by specifiying a parent for each child 'Pom' and specifying child 'Pom' modules in the parent as well.In this scenario Packaging type specifier for parent will always be 'Pom' while children will have necessary packaging types (ie:- bundle,jar ; Packaging type --> is how you define the output of the build )

Maven2 recognizes each module/source build as an Artifact. Hence you need to specify Group Id, Artifact Id for each build.

  • Group Id - which group does the build belong to .
  • Artifact Id - Specific name/Identifier of the build
So hence when you explore ~/.m2 repo , your build will be located (if you have already built it of course..) at ~/.m2/ ${GroupId}.replaceAll(".","/") /${ArtifactId}/${Version}

I will discuss maven2 commands in the next Article...So stay tuned...

------------------------------------------------------------------------------
My next post Using maven2 part2

Hi

Posted by U.S. Wickramasighe | Posted on Sunday, December 07, 2008

This is my First Blog...
I am very much new to Blogging and all so watch out for flops...
Please feel free to view and comment on my Articles..
Thnx

Technorati Profile