[
https://issues.apache.org/jira/browse/MNG-7310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17433021#comment-17433021
]
Martin Kanters commented on MNG-7310:
-------------------------------------
Ok, I found out a couple of things.
First of all, it only fails when the plugin is an extensions, with a new
lifecycle. In this case, spring-cloud-contract-verifier [adds
one|https://github.com/spring-cloud/spring-cloud-contract/blob/e73d6526bfb3240f9dc33d6afcf2be17e5383f49/spring-cloud-contract-tools/spring-cloud-contract-maven-plugin/src/main/resources/META-INF/plexus/components.xml].
This is also where the ${project.version}s are coming from, which ultimately
lets the build fail.
Secondly, I've debugged both a working version of Maven (3.8.3) and the latest
master to try and see the differences. I traced it down to the
DefaultLifecycles class. It looks like it loads the spring-cloud extension
correctly while building the "demo" module (where it is registered, so that's
good). But only for the current master Maven version, the new spring cloud
extension is still present in the "demo2" module during the build. In the Maven
3.8.3, it is not there anymore.
Since the [offending
commit|https://github.com/apache/maven/commit/9567da2bc889a94f5c3b692b4afb310ddbacd6e5]
has changed a lot of stuff regarding dependency injection, it must have to do
something with that. I'm just sure how
[lifecyclesMap|https://github.com/apache/maven/blob/c3962c1a6c0b40abbfb12740253437f6431b234b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycles.java#L54]
is dynamically changing on runtime.
It would help a lot if someone more into the dependency injection system could
give a pointer.
> Maven loads plugin from another submodule
> -----------------------------------------
>
> Key: MNG-7310
> URL: https://issues.apache.org/jira/browse/MNG-7310
> Project: Maven
> Issue Type: Bug
> Affects Versions: 4.0.0-alpha-1
> Reporter: Martin Kanters
> Priority: Major
> Attachments: demo-plugins.zip
>
>
> With the latest Maven master, I'm not able to build a certain multi module
> project.
> It fails with the following error:
> C:\work\apache\demo>mvn validate
> [INFO] Scanning for projects...
> ...
> [ERROR] The build could not read 1 project -> [Help 1]
> [ERROR]
> [ERROR] The project com.example:demo2:0.0.1-SNAPSHOT
> (C:\work\apache\demo\demo2\pom.xml) has 1 error
> [ERROR] 'build.plugins.plugin.version' for
> org.springframework.cloud:spring-cloud-contract-maven-plugin must be a valid
> version but is '${project.version}'. @
> org.apache.maven:maven-core:4.0.0-alpha-1-SNAPSHOT:default-lifecycle-bindings
> The project looks as follows:
> parent
> – demo (module containing plugin "spring-cloud-contract-maven-plugin")
> – demo2 (module)
> "demo2" has no dependency on "demo" and the parent of "demo2" is "parent"..
> Somehow, the plugin from "demo" leaks into "demo2", which I've verified is
> the case during a debug session.
> I'm still unsure of a couple of things:
> - Does it only happen with the "spring-cloud-contract-maven-plugin" plugin?
> - Where does ${project.version} come from? (I've not defined it)
> I've done a bisect and tracked it down to the following commit:
> [[MNG-5577] Convert maven-core to JSR
> 330|https://github.com/apache/maven/commit/9567da2bc889a94f5c3b692b4afb310ddbacd6e5]
> Subject project is attached. Reproduce with the current master of Maven: mvn
> validate.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)