Marcin Zarębski created MNG-6373: ------------------------------------ Summary: Despite inherited=false, plugin version and dependencies are inherited Key: MNG-6373 URL: https://issues.apache.org/jira/browse/MNG-6373 Project: Maven Issue Type: Bug Components: Inheritance and Interpolation, Plugins and Lifecycle Affects Versions: 3.5.3, 3.5.0, 3.2.1, 3.1.0 Reporter: Marcin Zarębski
There seems to be an issue with skipping plugin inheritance. If the documentation is right, build plugin with property {{<inherited>false</inherited>}} should not be inherited in child projects. This is inconsistent with observed behavior. Having POM inheritance chain of 3 projects (let's name them uber-parent, parent and child) and build plugin definition in uber-parent marked with {{inherited=false}}, the plugin's version and dependencies are still inherited in child projects. The behavior was reproduced on versions 3.1.0, 3.2.1, 3.5.0, 3.5.3. h3. Steps to reproduce This is an example of the weird behavior. Problem can be seen in effective POM for either parent or child project. Here are three POM definitions inheriting each other: h4. Uber-parent pom.xml {code} <project> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>uber-parent</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging> <build> <plugins> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> <version>1.1</version> <executions> <execution> <goals> <goal>execute</goal> </goals> <phase>test</phase> </execution> </executions> <configuration> <scripts> <script>file:///${project.basedir}/src/main/groovyScripts/generateBomPropertiesFile.groovy</script> </scripts> </configuration> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.3.0</version> </dependency> </dependencies> <inherited>false</inherited> </plugin> </plugins> </build> </project> {code} h4. Parent pom.xml {code} <project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.example</groupId> <artifactId>uber-parent</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>parent</artifactId> <packaging>pom</packaging> <build> <pluginManagement> <plugins> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> <version>1.6</version> <executions> <execution> <goals> <goal>compileTests</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.4.14</version> </dependency> </dependencies> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> </plugin> </plugins> </build> </project> {code} h4. Child pom.xml {code} <project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.example</groupId> <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>child</artifactId> <packaging>jar</packaging> <build> <plugins> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> </plugin> </plugins> </build> </project> {code} h4. Excerpt from effective POM for either parent or child project {code} <pluginManagement> <plugins> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> <version>1.6</version> <executions> <execution> <goals> <goal>compileTests</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.4.14</version> </dependency> </dependencies> </plugin> </plugins> </pluginManagement> <plugins> <plugin> <groupId>org.codehaus.gmavenplus</groupId> <artifactId>gmavenplus-plugin</artifactId> <version>1.1</version> <executions> <execution> <goals> <goal>compileTests</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.3.0</version> <scope>compile</scope> </dependency> </dependencies> </plugin> </plugins> {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)