告诉 Gradle
以下内容的最简单方法是什么:
检索“junit”依赖项并获取其最新的“发布”版本。
管理 Maven 和 Ivy 存储库对我来说有点陌生。我尝试了以下步骤,它们导致 Could not resolve dependency ...
错误:
编写
compile "junit:junit:latest.release"
并将存储库设置为仅mavenCentral()
(但是,如果我说“junit:junit:4.10”,它会起作用)。写
compile "junit:junit:latest.release"
存储库设置如下:
ivy {
// I also tried 'http://maven.org' and other possible variants.
url "http://repo1.maven.org"
layout "maven"
}
- 尝试使用 Spring Source Ivy 存储库:
ivy {
artifactPattern "http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
ivyPattern "http://repository.springsource.com/ivy/libraries/release/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
}
也许我误解了什么。为什么获取 最新 版本的依赖项如此困难?
原文由 Yippie-Ki-Yay 发布,翻译遵循 CC BY-SA 4.0 许可协议
Gradle 目前不支持 Maven 的
RELEASE
(很少使用和弃用),但它支持 Ivy 的latest.release
(以及快照latest.integration
)。但是,一般建议是针对确切的版本进行构建。否则,构建可能会变成彩票。