Change By: Mirko Friedenhagen (09/Jul/12 3:02 PM)
Description: The rule throws a NPE when it is configured in the {{pluginManagement}} section of the POM as it will try to get needed information from the {{plugin}} section.

{noformat}
Caused by: java.lang.NullPointerException
at org.apache.maven.plugins.enforcer.RequirePropertyDiverges.getRuleConfigurations(RequirePropertyDiverges.java:241)
at org.apache.maven.plugins.enforcer.RequirePropertyDiverges.findDefiningParent(RequirePropertyDiverges.java:161)
at org.apache.maven.plugins.enforcer.RequirePropertyDiverges.execute(RequirePropertyDiverges.java:75)
at org.apache.maven.plugins.enforcer.EnforceMojo.execute(EnforceMojo.java:190)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
{noformat}


This succeeds:
{code:xml}
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.0</version>
                <dependencies>
                <dependency>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>extra-enforcer-rules</artifactId>
                    <version>1.0-alpha-4-SNAPSHOT</version>
                </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <configuration>
          <rules>
            <requirePropertyDiverges>
              <property>project.url</property>
              <regex>http://company/company-parent-pom/.*</regex>
            </requirePropertyDiverges>
          </rules>
        </configuration>
      </plugin>
    </plugins>
  </build>
{code}

while putting the rule into {{pluginManagement}} fails with a NPE:
{code:xml}
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>1.0</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>extra-enforcer-rules</artifactId>
                            <version>1.0-alpha-4-SNAPSHOT</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <rules>
                            <requirePropertyDiverges>
                                <property>project.url</property>
                                <regex>http://company/company-parent-pom/.*</regex>
                            </requirePropertyDiverges>
                        </rules>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
{code}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to