apache / apache/maven

[MNG-6373] Despite inherited=false, plugin version and dependencies are inherited

Open
#7,476 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Marcin Zarębski](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=marcin%20zar%C4%99bski)** opened **[MNG-6373](https://issues.apache.org/jira/browse/MNG-6373?redirect=false)** and commented

There seems to be an issue with skipping plugin inheritance. If the documentation is right, build plugin with property `false` 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.

### 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:

#### Uber-parent pom.xml

```

4.0.0

com.example
uber-parent
1.0-SNAPSHOT
pom




org.codehaus.gmavenplus
gmavenplus-plugin
1.1



execute

test




file:///${project.basedir}/src/main/groovyScripts/generateBomPropertiesFile.groovy




org.codehaus.groovy
groovy-all
2.3.0


false


```

#### Parent pom.xml

```

4.0.0


com.example
uber-parent
1.0-SNAPSHOT

parent
pom





org.codehaus.gmavenplus
gmavenplus-plugin
1.6



compileTests





org.codehaus.groovy
groovy-all
2.4.14







org.codehaus.gmavenplus
gmavenplus-plugin


```

#### Child pom.xml

```

4.0.0


com.example
parent
1.0-SNAPSHOT

child
jar




org.codehaus.gmavenplus
gmavenplus-plugin


```

#### Excerpt from effective POM for either parent or child project

```



org.codehaus.gmavenplus
gmavenplus-plugin
1.6



compileTests





org.codehaus.groovy
groovy-all
2.4.14




org.codehaus.gmavenplus
gmavenplus-plugin
1.1



compileTests





org.codehaus.groovy
groovy-all
2.3.0
compile


```

---

**Affects:** 3.1.0, 3.2.1, 3.5.0, 3.5.2, 3.5.3

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the three-project inheritance chain from the supplied uber-parent, parent, and child pom.xml examples, then inspect each project's effective POM. Compare the plugin version and dependencies with the uber-parent's inherited=false setting across the affected Maven versions. Done means the effective POM no longer carries those inherited values into the parent or child.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.