apache / apache/maven

[MNG-7925] Global model cache with maven extensions fails to track the source location

Open
#8,989 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

**[Jonas Rutishauser](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jonasr)** opened **[MNG-7925](https://issues.apache.org/jira/browse/MNG-7925?redirect=false)** and commented

If we have a parent pom like this:

```xml

4.0.0

test
cache-bug-parent
1.0.0-SNAPSHOT
pom




maven-install-plugin
3.1.1


```

And we have a project pom which uses this parent pom whilst an extension (declared in `.mvn/extensions.xml`) uses the same parent, the global model cache is the reason that the source location is lost.

To reproduce the bug the following projects can be used:
- The extension (empty jar is enough):

```xml
```

\
\4.0.0\
\
\test\
\cache-bug-parent\
\1.0.0-SNAPSHOT\
\
\cache-bug-extension\
\
```
- The test project:
`.mvn/extensions.xml`:
```xml
\
\
\test\
\cache-bug-extension\
\1.0.0-SNAPSHOT\
\
\
```
`pom.xml`:
```xml
\
\4.0.0\


test
cache-bug-parent
1.0.0-SNAPSHOT

cache-bug
pom




maven-enforcer-plugin
3.4.1


enforce-version
enforce



org.apache.maven.plugins:maven-enforcer-plugin
org.apache.maven.plugins:maven-clean-plugin,org.apache.maven.plugins:maven-deploy-plugin,org.apache.maven.plugins:maven-site-plugin







\
```
The test project can be built with `mvn clean verify -Dmaven.defaultProjectBuilder.disableGlobalModelCache=true`, but fails with `mvn clean verify`.
The enforcer plugin uses the source location to determine from which location the plugin declaration comes from.

---

**Affects:** 3.9.5

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.