Posts Tagged ‘documentation’
Maven, help-plugin and continuous integration
When a maven build fails in continuous integration you often end up reading the console output, sometimes browsing kilobytes of text (yes, maven outputs a lot and can seem chaotic). To ease build debugging you can tell maven to output some introspectional data.
The idea is to use the maven-help-plugin a lot but you can add others and home made ones to the mix. To quickly see what can easily get outputed my maven you can play with the following commands :
mvn help:system
mvn help:active-profiles
mvn help:effective-settings
mvn help:effective-pom
Here is a sample output of the active-profiles goal :
[INFO] ------------------------------------------------------------------------
[INFO] Building my-project
[INFO] task-segment: [help:active-profiles] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [help:active-profiles]
[INFO]
Active Profiles for Project 'myGroupId:myArtifactId:jar:0.1.0-SNAPSHOT':
The following profiles are active:
- continuous-integration (source: settings.xml)
- libs-daily (source: pom)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
Adding such output at the very start of builds is really handy when setting up a CI service or during build refactorings.
Note that if a profile is defined in a parent pom it won’t be shown as activated in submodules by help:active-profiles but if you read the help:effective-pom output on one of the modules you’ll see it’s effectively activated, see this comment in MNG-3228.
Hope this helps.
If you read this, you certainly want to read Maven Continuous Integration Best Practices.
