Fork me on GitHub

Require Property Diverges

This rule checks that a property in a project diverges from one given in an ancestor project.

Say you want to enforce a policy in your company's company-parent-pom that all your projects' project.urls should point to a link in your company's wiki. Maven automatically appends the artifactId to the inherited project.url from your company-parent-pom, which will probably just be an invalid url. So you specify that derived projects have to override the project.url property and should not match http://company/wiki/company-parent-pom/.* Or you want to make sure projects do not "reuse" the project.groupId of the company-parent-pom.

The following parameters are supported by this rule:

  • property - name of the property which should diverge. Must be given.
  • regex - match the property value to a given regular expression. When not given, this rule checks that the property in the child does not equal the one from the defining ancestor.

Note that certain properties (e.g. project.url or project.scm.connection are automatically extended with the child's project.artifactId, so using a regex will help in this case, see sample below.

Another caveat: properties defined in the properties section will be overwritten with those from inheriting projects so you have to:

  • define a regex for these as well, see the rule definition for the property in the mojo-1853 integration test when the property name contains a dot.
  • use an alternative syntax ala when the property name does not contain a dot.

Sample Plugin Configuration:

    <>just a value</>
    <justAPropertyWithoutDots>just another value</justAPropertyWithoutDots>
        <version>1.0</version> <!-- find the latest version at -->
                  <property>project.groupId</property><!-- children must have a diverging groupId -->
                  <regex>just a value</regex><!-- need to use a regex here as children's value will override the definition -->


Apache, Apache Maven, Maven and the Apache feather logo are trademarks of The Apache Software Foundation.