我正在尝试将我的公司从 maven2 升级到 maven3,一个阻塞器是一种奇怪的现象,当我激活某个配置文件时,maven reactor 开始搜索大量旧的依赖信息(10 多分钟直到内存耗尽)。
如果存在具有范围的依赖项(例如“[3.0,)”),我已经看到了这种行为,但我很确定我已经清除了所有这些。
使用 mvn dependency:tree 和 mvn help:effective-pom 不会告诉我是否有任何范围依赖,并且在 pom.xml 文件中对[, ], (或)的 grepping 没有任何结果,所以我有点难过关于下一步戳哪里的那一刻。
例如,在我的 pom 中,我有这个配置文件激活部分:
<profile>
<id>demo</id>
<activation>
<property>
<name>client</name>
<value>demo</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.mycompany</groupId>
<artifactId>client-demo</artifactId>
<version>3.32.0-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
然后当我在命令行上运行它时:
mvn -Dclient=演示码头:运行
输出是对我的客户端演示工件的每个历史快照的成千上万次 pom 数据搜索:
....snip.....
Downloading:https://nexus.mycompany.com/nexus/content/groups/public/com/mycompany/client-demo/2.16.7-SNAPSHOT/client-demo-2.16.7-SNAPSHOT.pom
[WARNING] The POM for com.mycompany:client-demo:jar:2.16.7-SNAPSHOT is missing, no dependency information available
Downloading: https://nexus.mycompany.com/nexus/content/groups/public/com/mycompany/client-demo/2.16.8-SNAPSHOT/maven-metadata.xml
Downloading: https://nexus.mycompany.com/nexus/content/groups/public/com/mycompany/client-demo/2.16.8-SNAPSHOT/client-demo-2.16.8-SNAPSHOT.pom
[WARNING] The POM for com.mycompany:client-demo:jar:2.16.8-SNAPSHOT is missing, no dependency information available
Downloading: https://nexus.mycompany.com/nexus/content/groups/public/com/mycompany/client-demo/2.16.9-SNAPSHOT/maven-metadata.xml
Downloading: https://nexus.mycompany.com/nexus/content/groups/public/com/mycompany/client-demo/2.16.9-SNAPSHOT/client-demo-2.16.9-SNAPSHOT.pom
[WARNING] The POM for com.mycompany:client-demo:jar:2.16.9-SNAPSHOT is missing, no dependency information available
Downloading: https://nexus.mycompany.com/nexus/content/groups/public/com/mycompany/client-demo/2.16.10-SNAPSHOT/maven-metadata.xml
Downloading: https://nexus.mycompany.com/nexus/content/groups/public/com/mycompany/client-demo/2.16.10-SNAPSHOT/client-demo-2.16.10-SNAPSHOT.pom
....snip.....
编辑:: 更多信息。
此问题似乎纯粹与通过配置文件激活包含附加依赖项有关,而不与依赖项本身有关。例如,如果我摆脱配置文件并直接依赖 com.mycompany.client-demo-3.32.0-SNAPSHOT,则不会出现不良行为。所以这与反应堆处理配置文件激活依赖项的方式有关......我认为