I'm getting the following warnings when I do `mvn clean package
07:02:39 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
07:02:39 [WARNING] o proj:fs-models:jar:1.0.0-SNAPSHOT12345 (compile)
07:02:39 [WARNING] Try running the build up to the lifecycle phase "package"
07:02:39 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
07:02:39 [WARNING] o proj:fs-api:jar:1.0.0-SNAPSHOT12345 (compile)
07:02:39 [WARNING] o proj:fs-models:jar:1.0.0-SNAPSHOT12345 (compile)
07:02:39 [WARNING] Try running the build up to the lifecycle phase "package"
07:02:39 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
07:02:39 [WARNING] o proj:ep-api-models:jar:1.0.0-SNAPSHOT12345 (compile)
07:02:39 [WARNING] o proj:pckg-models:jar:1.0.0-SNAPSHOT12345 (provided)
07:02:39 [WARNING] o proj:fs-api:jar:1.0.0-SNAPSHOT12345 (provided)
07:02:39 [WARNING] o proj:pckg-fs-models:jar:1.0.0-SNAPSHOT12345 (provided)
07:02:39 [WARNING] Try running the build up to the lifecycle phase "package"
07:02:39 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
07:02:39 [WARNING] o proj:models:jar:1.0.0-SNAPSHOT12345 (compile)
07:02:39 [WARNING] o proj:ep-api-models:jar:1.0.0-SNAPSHOT12345 (compile)
07:02:39 [WARNING] Try running the build up to the lifecycle phase "package"
Those dependencies are part of the reactor but maven couldn't resolve it. What could be a cause of this?
The issue is that maven somehow tries to download the modules from remote repositories but shouldn't because they are yet to be built. In my case, it is caused by aggregator maven plugins invoking aggregator goals. These aggregator goals require full information about the project’s dependencies thus maven tries to download them.
I troubleshooted this problem by commenting out all aggregator plugins in my project and rebuild it again. If maven doesn't download them anymore, then they are the culprits. These plugins usually have aggregate- on their goal. Example:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<inherited>false</inherited>
<version>1.16</version>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>aggregate-add-third-party</goal>
</goals>
</execution>
</executions>
</plugin>
Notice the aggregate-add-third-party-goal.
Related article: https://blog.sonatype.com/2009/05/how-to-make-a-plugin-run-once-during-a-build/
Some plugins are what we call "aggregators" which means they actually do want all the information about the full multi-module build before execution. These plugins, when run on a tree of projects cause Maven to resolve all the children before calling the plugin's execute() method. In this mode a plugin executes just once, but effectively on the whole tree at once. (as a side note, you never want to bind an aggregator goal in your pom as this would cause the plugin to run an n! recursive build since the lifecycle would step into each child and execute the aggregator...which would cause Maven to reresolve all the children, etc)
Once you have identified the causing plugins, you can do one of the following:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With