Building a maven2 project

Hudson provides a job type dedicated for Maven2. This job type integrates Hudson deeply with Maven2 and provides the following benefits compared to more generic free-style software project.

  • Hudson parses Maven POMs to obtain much of the information needed to do its work. As a result, amount of configuration is drastically reduced.
  • Hudson listens to Maven execution and figures out what should be done when on its own. For example, it will automatically record JUnit report when Maven runs the test phase. Or if you run the javadoc goal, Hudson will automatically record javadoc.

Thus mostly you just need to configure SCM information and what goals you'd like to run, and Hudson will figure out everything else.

Maven version

Some user reported a problem using this feature with Maven versions other than 2.0.4. We are particularly interested in any reports on this kind of issues.

Here is one such report: Using Hudson 1.337 on top of Tomcat 6.0.14 on top of MS XP, Maven 2.0.7 would "hang" inside Hudson but not using the command line.  Trying it with Maven 2.0.4 resulted in success inside Hudson, and a resolution of the problem with 2.0.7. 

TODO
Talk about how maven modules gets represented in sub projects, and how build numbers among sub-projects are controlled. Use some screenshots.

Automatic build chaining from module dependencies

Hudson reads dependencies of your project from your POM, and if they are also built on Hudson, triggers are set up in such a way that a new build in one of those dependencies will automatically start a new build of your project. Hudson understands all kinds of dependencies in POM. Namely,

  • parent POM
  • <dependencies> section of your project
  • <extensions> section of your project
  • <reporting> section of your project

This process takes versions into account, so you can have multiple versions/branches of your project on the same Hudson and it will correctly determine dependencies.

Labels:

maven2 maven2 Delete
pom pom Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.
  1. Jun 15

    Carolyn Teo says:

    I have a project that has this setup in a project parent POM Module 1 <d...

    I have a project that has this setup in a project
    parent POM
    Module 1

    • <dependencies> section of your project
    • <extensions> section of your project
    • <reporting> section of your project
      Module 2
    • <dependencies> section of your project
    • <extensions> section of your project
    • <reporting> section of your project
      Module 3
    • <dependencies> section of your project
    • <extensions> section of your project
    • <reporting> section of your project

    Each module creates its own reporting section. However Hudson only display the reporting section in the Module 1. Module 2 and 3 are not accessible.

    Is there any way to get Hudson to display all 3?

    Thanks!

  2. Jul 01

    Tom Pijl says:

    If a maven2 job is triggered by SCM it logs in with user "anonymous". When solvi...

    If a maven2 job is triggered by SCM it logs in with user "anonymous". When solving dependencies it uses a local repository.

    Where is that located in this case? And if I have a specific settings.xml where should I place this in this case

    I use Javawrapper to start my Hudson as a daemon on an OpenSuse 10.3 Linux server.