Skip to content
Marcin Kuthan edited this page Mar 27, 2015 · 1 revision

Introduction

Corporate POM centralizes projects configuration:

  • Plugin configurations
  • Distribution management settings
  • Reporting configurations

Corporate POM defines corporate-pom profile. The profile is used to configure Corporate POM build itself, without influence to child POMs lifecycles. The profile has to be explicitly activated for all Corporate POM related tasks.

Plugin Versions Update

One of the Corporate POM maintenance tasks is keeping configured plugin versions uptodate. Plugin versions can be managed automatically within Maven Versions Plugin.

Notice:

Automatic updates requires correct plugin metadata files in the repository. If metadata files are invalid, Maven Versions Plugin is not able to figure out the latest plugin versions, and commands below won't update these plugins.

Display Available Updates

All plugin versions are defined in Corporate POM within properties. Updating plugin versions is a regular maintenance task for Corporate POM and can be automated. Call versions:display-property-updates goal to display a report of available plugin updates:

mvn -P corporate-pom versions:display-property-updates
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building corporate-pom 1.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:1.2:display-property-updates (default-cli) @ corporate-pom ---
[INFO] artifact org.apache.maven.plugins:maven-dependency-plugin: checking for updates from acme-release-plugins
(...)
[INFO] 
[INFO] The following version properties are referencing the newest available version:
[INFO]   ${com.acme.corporate-pom.surefireReportVersion} ........................ 2.6 -> 2.7
[INFO]   ${com.acme.corporate-pom.findbugsVersion} ............................ 2.3 -> 2.3.1
[INFO]   ${com.acme.corporate-pom.surefireVersion} .............................. 2.6 -> 2.7
[INFO] The following version property updates are available:
[INFO]   ${com.acme.corporate-pom.surefireReportVersion} ........................ 2.6 -> 2.7
[INFO]   ${com.acme.corporate-pom.findbugsVersion} ............................ 2.3 -> 2.3.1
[INFO]   ${com.acme.corporate-pom.surefireVersion} .............................. 2.6 -> 2.7
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 56.188s
[INFO] Finished at: Wed Dec 22 09:37:55 CET 2010
[INFO] Final Memory: 8M/15M
[INFO] ------------------------------------------------------------------------

In the example updates for: surefire, surefire report and findbugs plugins are available.

Perform Updates

The properties can be updated by calling versions:update-properties goal:

mvn -P corporate-pom versions:update-properties
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building corporate-pom 1.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:1.2:update-properties (default-cli) @ corporate-pom ---
[INFO] Property ${com.acme.corporate-pom.dependencyVersion}: Leaving unchanged as 2.1
[INFO] Property ${com.acme.corporate-pom.pmdVersion}: Leaving unchanged as 2.5
[INFO] Property ${com.acme.corporate-pom.deployVersion}: Leaving unchanged as 2.5
[INFO] Property ${com.acme.corporate-pom.oneVersion}: Leaving unchanged as 1.2
[INFO] Updated ${com.acme.corporate-pom.surefireReportVersion} from 2.6 to 2.7
[INFO] Property ${com.acme.corporate-pom.resourcesVersion}: Leaving unchanged as 2.4.3
[INFO] Property ${com.acme.corporate-pom.jarVersion}: Leaving unchanged as 2.3.1
[INFO] Property ${com.acme.corporate-pom.remoteResourcesVersion}: Leaving unchanged as 1.1
[INFO] Property ${com.acme.corporate-pom.pluginVersion}: Leaving unchanged as 2.6
[INFO] Property ${com.acme.corporate-pom.versionsVersion}: Leaving unchanged as 1.2
[INFO] Property ${com.acme.corporate-pom.sourceVersion}: Leaving unchanged as 2.1.2
[INFO] Property ${com.acme.corporate-pom.cloverVersion}: Leaving unchanged as 3.0.2
[INFO] Property ${com.acme.corporate-pom.enforcerVersion}: Leaving unchanged as 1.0
[INFO] Property ${com.acme.corporate-pom.rarVersion}: Leaving unchanged as 2.2
[INFO] Property ${com.acme.corporate-pom.jxrVersion}: Leaving unchanged as 2.2
[INFO] Property ${com.acme.corporate-pom.eclipseVersion}: Leaving unchanged as 2.8
[INFO] Property ${com.acme.corporate-pom.cleanVersion}: Leaving unchanged as 2.4.1
[INFO] Property ${com.acme.corporate-pom.earVersion}: Leaving unchanged as 2.4.2
[INFO] Property ${com.acme.corporate-pom.shadeVersion}: Leaving unchanged as 1.4
[INFO] Updated ${com.acme.corporate-pom.findbugsVersion} from 2.3 to 2.3.1
[INFO] Property ${com.acme.corporate-pom.jarsignerVersion}: Leaving unchanged as 1.2
[INFO] Property ${com.acme.corporate-pom.javadocVersion}: Leaving unchanged as 2.7
[INFO] Property ${com.acme.corporate-pom.reactorVersion}: Leaving unchanged as 1.0
[INFO] Property ${com.acme.corporate-pom.ejbVersion}: Leaving unchanged as 2.3
[INFO] Property ${com.acme.corporate-pom.checkstyleVersion}: Leaving unchanged as 2.6
[INFO] Property ${com.acme.corporate-pom.assemblyVersion}: Leaving unchanged as 2.2
[INFO] Property ${com.acme.corporate-pom.invokerVersion}: Leaving unchanged as 1.5
[INFO] Property ${com.acme.corporate-pom.warVersion}: Leaving unchanged as 2.1.1
[INFO] Property ${com.acme.corporate-pom.verifierVersion}: Leaving unchanged as 1.0
[INFO] Property ${com.acme.corporate-pom.antVersion}: Leaving unchanged as 2.3
[INFO] Property ${com.acme.corporate-pom.compilerVersion}: Leaving unchanged as 2.3.2
[INFO] Property ${com.acme.corporate-pom.installVersion}: Leaving unchanged as 2.3.1
[INFO] Property ${com.acme.corporate-pom.stageVersion}: Leaving unchanged as 1.0-alpha-2
[INFO] Property ${com.acme.corporate-pom.antrunVersion}: Leaving unchanged as 1.6
[INFO] Property ${com.acme.corporate-pom.gpgVersion}: Leaving unchanged as 1.1
[INFO] Property ${com.acme.corporate-pom.patchVersion}: Leaving unchanged as 1.1.1
[INFO] Updated ${com.acme.corporate-pom.surefireVersion} from 2.6 to 2.7
[INFO] Property ${com.acme.corporate-pom.projectInfoVersion}: Leaving unchanged as 2.3
[INFO] Property ${com.acme.corporate-pom.helpVersion}: Leaving unchanged as 2.1.1
[INFO] Property ${com.acme.corporate-pom.archetypeVersion}: Leaving unchanged as 2.0
[INFO] Property ${com.acme.corporate-pom.siteVersion}: Leaving unchanged as 3.0-beta-3
[INFO] Property ${com.acme.corporate-pom.scmVersion}: Leaving unchanged as 1.4
[INFO] Property ${com.acme.corporate-pom.repositoryVersion}: Leaving unchanged as 2.3.1
[INFO] Property ${com.acme.corporate-pom.releaseVersion}: Leaving unchanged as 2.1
[INFO] Property ${com.acme.corporate-pom.pdfVersion}: Leaving unchanged as 1.1
[INFO] Property ${com.acme.corporate-pom.ideaVersion}: Leaving unchanged as 2.2
[INFO] Property ${com.acme.corporate-pom.toolchainsVersion}: Leaving unchanged as 1.0
[INFO] Property ${com.acme.corporate-pom.failsafeVersion}: Leaving unchanged as 2.7
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.977s
[INFO] Finished at: Wed Dec 22 10:05:54 CET 2010
[INFO] Final Memory: 9M/17M
[INFO] ------------------------------------------------------------------------

To verify plugin updates call versions:display-property-updates goal again:

mvn -P corporate-pom versions:display-property-updates
[INFO] Scanning for projects...
Downloading: http://repository.intranet.acme.com/release-plugins-repository/org/codehaus/mojo/findbugs-maven-plugin/2.3.1/findbugs-maven-plugin-2.3.1.jar
Downloaded: http://repository.intranet.acme.com/release-plugins-repository/org/codehaus/mojo/findbugs-maven-plugin/2.3.1/findbugs-maven-plugin-2.3.1.jar (111 KB at 57.8 KB/sec)
Downloading: http://repository.intranet.acme.com/release-plugins-repository/org/apache/maven/plugins/maven-surefire-report-plugin/2.7/maven-surefire-report-plugin-2.7.jar
Downloaded: http://repository.intranet.acme.com/release-plugins-repository/org/apache/maven/plugins/maven-surefire-report-plugin/2.7/maven-surefire-report-plugin-2.7.jar (39 KB at 17.1 KB/sec)
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building corporate-pom 1.5-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:1.2:display-property-updates (default-cli) @ corporate-pom ---
[INFO] 
[INFO] The following version properties are referencing the newest available version:
[INFO] All version properties are referencing the newest version available.
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.718s
[INFO] Finished at: Wed Dec 22 10:07:54 CET 2010
[INFO] Final Memory: 9M/17M
[INFO] ------------------------------------------------------------------------

The plugin updates were successfully downloaded from corporate repository. All plugins are in the newest available versions now and Corporate POM is ready for next minor release.

Automatic Updates Exclusion

If a plugin version should not be updated automatically, define excludeProperties property. To disable updates for Sonar plugin:

<excludeProperties>com.acme.corporate-pom.sonarVersion</excludeProperties>

References To Corporate POM Update

When new version of Corporate POM is released, references to the POM should be updated. This manual task can be automated, you don't even need to know the latest Corporate POM version.

Call versions:update-parent goal to update parent section in the project POM:

mvn versions:update-parent
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-war-webapp 0.0.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:1.2:update-parent (default-cli) @ simple-war-webapp ---
[INFO] Updating parent from 1.21 to 1.22
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.190s
[INFO] Finished at: Wed Jan 19 11:28:46 CET 2011
[INFO] Final Memory: 10M/18M
[INFO] ------------------------------------------------------------------------

In the example, project parent was updated from version 1.21 to the latest released Corporate POM 1.22.

To commit changes (Poor Man's SCM) call versions:commit goal:

mvn versions:commit       
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-war-webapp 0.0.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:1.2:commit (default-cli) @ simple-war-webapp ---
[INFO] Accepting all changes to C:\_data\projects\m4enterprise\trunk\simple-war\pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.832s
[INFO] Finished at: Wed Jan 19 11:29:24 CET 2011
[INFO] Final Memory: 10M/17M
[INFO] ------------------------------------------------------------------------

To revert changes (Poor Man's SCM) call versions:revert goal:

mvn versions:revert       
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building simple-war-webapp 0.0.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- versions-maven-plugin:1.2:revert (default-cli) @ simple-war-webapp ---
[INFO] Restoring C:\_data\projects\m4enterprise\trunk\simple-war\pom.xml from C:\_data\projects\m4enterprise\trunk\simple-war\pom.xml.versionsBackup
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.286s
[INFO] Finished at: Wed Jan 19 11:27:39 CET 2011
[INFO] Final Memory: 10M/17M
[INFO] ------------------------------------------------------------------------