gpt4 book ai didi

Maven 无法解决来自 react 堆的依赖关系

转载 作者:行者123 更新时间:2023-12-05 05:11:35 25 4
gpt4 key购买 nike

我在执行 `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"

这些依赖项是 react 器的一部分,但 Maven 无法解析它。这可能是什么原因造成的?

最佳答案

问题是 Maven 以某种方式尝试从远程存储库下载模块,但不应该这样做,因为它们尚未构建。在我的例子中,它是由调用聚合器目标的聚合器 Maven 插件引起的。这些聚合器目标需要有关项目依赖项的完整信息,因此 Maven 会尝试下载它们。

我通过注释掉我项目中的所有 聚合器插件并重新构建它来解决这个问题。如果 maven 不再下载它们,那么它们就是罪魁祸首。这些插件的目标通常是 aggregate-。示例:

<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>

注意 aggregate-add-third-party-goal

相关文章: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)

一旦您确定了引起问题的插件,您可以执行以下操作之一:

  1. 将它们移动到 maven 配置文件上,以便它们仅在您使用配置文件时激活
  2. 如果目标是报告,请将其移至 pom 的报告部分 (see configuring reports)。

关于Maven 无法解决来自 react 堆的依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55308956/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com