apache / apache/maven

[MNG-7562] Mechanism for preventing inheritance of sections such as <licence>.

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

Description

**[Garret Wilson](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=garretwilson)** opened **[MNG-7562](https://issues.apache.org/jira/browse/MNG-7562?redirect=false)** and commented

There needs to a way in the Maven POM to prevent an element from being inherited altogether in child POMs.

We are currently publishing a Maven POM that is useful to serve as the parent POM for various projects. Some of the projects that use the POM will be open source, but some will not be. To designate our parent POM as open source, we include this:

```xml


Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0
repo

```

This essentially says, "this project is open source".

Unfortunately because of [POM inheritance](https://maven.apache.org/pom.html#Inheritance), any project that uses this parent POM will also effectively be saying "this project is also open source", because the effective POM of all descendant projects will also include this same license section.

Developers could try to remember to include some `` section to override this license, but the whole point of the parent POM is that it should given developers less to do, not more. Besides, some private projects (even ours) might not wish to indicate a license at all!

There needs to be a way for our public parent POM to indicate that it is open source without effectively making all child projects open source as well through POM inheritance. Preventing the `` section from being inherited is one example of a more general mechanism needed to say, "Do not inherit this element at all in child POMs".

---

**Affects:** 3.8.6

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.