TIME ATTACK







10:00

MAVEN




A Yiddish word, meaning
accumulator of knowledge

What is it?



Declarative build system

  • conv-over-conf
  • automatic dependency management
  • plugin-based

The purpose



source files 

->

 executable file

concept: Lifecycle



  • A set of sequential transitions (or phases) traversed in the transformation.

 
  • To each phase, a goal to perform on the partial product in that state of transition is bound.

 
  • A phase is also a hook to bind more goals, and a way for a goal to require is execution in a precise transition.

 

Default lifecycle



  • validate
  • compile
  • test
  • package
  • integration-test
  • verify
  • install
  • deploy 

 

The concept



code + resources (main and test)

-> lifecycle ->

artifact(s)

Conv over conf


On:

  • Sources
  • Artifacts
  • Packaging

Conv: source




 A part of source defines the artifact, the rest is for testing.


Each part contains java code and resources. (in the simplest case!)

Conv: source



Conv: artifact


An artifact is identified by its coordinates: 


    artifactId           (the name of the artifact itself)
    groupId              (conventionally the reversed company's domain)
    version              (major.minor[-SNAPSHOT])
    


(snaphot is the "development", or "not stable" state of an artifact)


Conv: packages


From the artifact coordinates, a convention about class packaging:
(everyone is creative about this)
 
groupId.artifactId.(whatever you want)


This makes easy, given a full-qualified class, know from which artifact it comes from.

Dependencies



An artifact could depend on more artifacts.
It just need to be declared in its descriptor (POM).

Maven will take care of find and retrieve the artifact for us, using its coordinates.


How?

Repositories



the POM

 



sample

extending



API + "maven plugin" artifacts.

Integrating a plugin is easy, but you have to write it in java.



WARNING: writing a plugin that defines a new lifecycle is HELL.




thanks





ta_mvn

By Tsukihara Caligin