Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
3.0.5
-
None
-
None
-
None
Description
If you have a aggregator-style plugin with requiresDependencyResolution, maven will try to download artefacts from remote (if they are not in your local repository or if you have a 'always' policy for that remote repository). Binding the plugin to different phases or calling from CLI didn't change the behaviour.
If the artefact actually exists in your remote repository, maven will download it. Even worse if you include this aggregator-styte plugin as part of the lifecycle of a module, because then the dependencies downloaded will be used - instead of the ones built in the reactor - for the rest of the build. It's pretty scary to build artefacts half reactor/half remote maven as a side effect of calling a plugin that just wants to print the dependencies' names.
If the artefact doesn't exist in your maven local repo or remote, maven will continue and the following warning:
The following dependencies could not be resolved at this point of the build but seem to be part of the reactor
That lead me to MNG-2277, and I would happily accept the warning if maven wasn't actually downloading and using the downloaded dependencies instead of the ones built in the reactor.
If the artefact exists in your local repo, looks like that one is being used (I'm not sure here).
The workaround I've found (only in maven 3) is to use requiresDependencyCollection (instead of requiresDependencyResolution), then I have to identify which ones are in the reactor, and just resolve the other ones. It doesn't feel right, I kinda trust maven to identify what is the reactor and what is not (even for aggregator-style plugins), and never override the reactor.
It would be enough if the dependencies list didn't include dependencies of intermodule artefacts:
Example:
- my-commons \- junit - my-other-module \- my-commons (not showing its deps because you can retrieve it - not resolving it either!)
I don't want to call "mvn install myplugin:goal", I need it to be part of the build as it produces resources included in my jars and wars.
Full log:
[INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] my-nice-project [INFO] child1 [INFO] child2 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building my-nice-project 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ Downloading: https://mynexus.com/content/groups/internal/com/mycompany/project/child1/1.0-SNAPSHOT/maven-metadata.xml Downloading: https://mynexus.com/content/groups/internal/com/mycompany/project/child1/1.0-SNAPSHOT/maven-metadata.xml Downloading: https://mynexus.com/content/groups/internal/com/mycompany/project/child1/1.0-SNAPSHOT/child1-1.0-SNAPSHOT.jar Downloading: https://mynexus.com/content/groups/internal/com/mycompany/project/child1/1.0-SNAPSHOT/child1-1.0-SNAPSHOT.jar [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor: [WARNING] o com.mycompany.project:child1:jar:1.0-SNAPSHOT (compile) [WARNING] Try running the build up to the lifecycle phase "package" [INFO] [INFO] --- myaggregator-maven-plugin:1.0-SNAPSHOT:list-deps (default-cli) @ my-nice-project --- [INFO] >>>>>> Project: my-nice-project [INFO] --------------- [INFO] >>>>>> Project: child1 [INFO] - junit:junit:jar:4.11 [INFO] - org.hamcrest:hamcrest-core:jar:1.3 [INFO] --------------- [INFO] >>>>>> Project: child2 [INFO] - com.mycompany.project:child1:jar:1.0-SNAPSHOT [INFO] - junit:junit:jar:4.11 [INFO] - org.hamcrest:hamcrest-core:jar:1.3 [INFO] - org.apache.logging.log4j:log4j-api:jar:2.0-beta9 [INFO] --------------- [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] my-nice-project ................................... SUCCESS [4.280s] [INFO] child1 ............................................ SKIPPED [INFO] child2 ............................................ SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.495s [INFO] Finished at: Fri Jan 17 17:10:10 EST 2014 [INFO] Final Memory: 6M/143M [INFO] ------------------------------------------------------------------------
I've attached the simplest example I could think of.
- Open zip file
- cd my-aggregator-plugin; mvn install
- rm -rf ~/.m2/repository/com/mycompany/project/
- cd my-nice-project; mvn com.mycompany.mavenplugin:myaggregator-maven-plugin:1.0-SNAPSHOT:list-deps
Attachments
Attachments
Issue Links
- relates to
-
MNG-250 make aggregation feasible
- Closed