【发布时间】:2016-08-12 06:19:32
【问题描述】:
我的 pom 中有 <scope>test</scope> 的依赖项。据我了解,maven 的范围概念仅在测试构建期间才需要。尽管如此,maven 尝试在mvn package 期间下载依赖项,这就是为什么我得到以下构建失败:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.278 s
[INFO] Finished at: 2016-04-19T22:11:59+02:00
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project my-module: Could not resolve dependencies for project com.mycompany.app:my-module:jar:1: Failure to find group-a:artifact-b:jar:tests:1.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]0
我使用以下 pom:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-module</artifactId>
<version>1</version>
<dependencies>
<dependency>
<groupId>group-a</groupId>
<artifactId>artifact-b</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
- 这是 maven 的预期行为吗?
- 在包/安装/部署构建期间是否有任何缓解措施可以忽略依赖关系?
感谢任何帮助
【问题讨论】:
-
Force maven update的可能重复
-
看链接的问题,需要用
-U开关调用Maven。 -
-U 是强制进行依赖更新。我需要避免在包构建期间使用依赖关系。
标签: maven testing build scope dependencies