Hi, See model builder algorithm [1] If someone codes a version in build/plugin, that mean he wants to override value injected from build/pluginManagement
consequence is that once overridden, pluginManagement doesn't apply any more so: defining a version in build/plugin in a global parent pom is generally a bad idea Regards, Hervé [1] http://maven.apache.org/ref/3-LATEST/maven-model-builder/ Le mercredi 12 février 2014 21:07:28 Karl Heinz Marbaise a écrit : > Hi, > i have a question. The following situation. Pom file which uses the > following parent: > > <parent> > <groupId>org.codehaus</groupId> > <artifactId>codehaus-parent</artifactId> > <version>4</version> > </parent> > > <prerequisites> > <maven>${mavenVersion}</maven> > </prerequisites> > > and the following part in my pom file: > > <build> > <pluginManagement> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-enforcer-plugin</artifactId> > <version>1.3.1</version> > </plugin> > </plugins> > </pluginManagement> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-enforcer-plugin</artifactId> > <executions> > <execution> > <id>enforce-maven</id> > <goals> > ... The rule does not matter.. > > > So if i call (Maven 2.2.1) > > mvn clean package I got the following error: > > [INFO] [clean:clean {execution: default-clean}] > [INFO] > ------------------------------------------------------------------------ > [ERROR] BUILD ERROR > [INFO] > ------------------------------------------------------------------------ > [INFO] Failed to configure plugin parameters for: > org.apache.maven.plugins:maven-enforcer-plugin:1.0 > > Cause: Class 'org.apache.maven.enforcer.rule.api.EnforcerRule' cannot be > instantiated > > So if i call with Maven 3.0.5: > > [ERROR] Failed to execute goal > org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce > (enforce-maven) on project test-enforcer: Unable to parse configuration > of mojo org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce for > parameter requireSameVersions: Abstract class or interface > 'org.apache.maven.enforcer.rule.api.EnforcerRule' cannot be instantiated > -> [Help 1] > > Maven 3.1.X and Maven 3.2.X tested as well... > > So this looks to me that the pluginManagement does not overwrite the > version 1.0 which is defined in the codehaus-parent. To be honest the > codehaus-parent does not define it via pluginManagement it just uses the > following: > > <build> > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-enforcer-plugin</artifactId> > <version>1.0</version> > <executions> > <execution> > <id>enforce-maven</id> > <goals> > <goal>enforce</goal> > </goals> > <configuration> > <rules> > <requireMavenVersion> > > <version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version> > <message>Maven 2.1.0 and 2.2.0 > produce incorrect GPG signatures and checksums respectively.</message> > </requireMavenVersion> > </rules> > </configuration> > </execution> > </executions> > </plugin> > </plugins> > > > First the codehaus-parent seemed to be wrong...so i can't overwrite the > version of the plugin by using a pluginManagement block in inherited > project which forces me to define the version explicitly in my pom in > the build block to get that working like this: > > <plugins> > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-enforcer-plugin</artifactId> > <version>1.3.1</version> > <executions> > > > WDYT ? Bug ? Right behaviour ? > > > Kind regards > Karl-Heinz Marbaise > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org > For additional commands, e-mail: dev-h...@maven.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For additional commands, e-mail: dev-h...@maven.apache.org