告诉 Gradle
以下内容的最简单方法是什么:
Retrieve 'junit' dependency and take its latest 'release' version.
管理 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]" }
也许我误解了什么。为什么获取依赖项的最新 版本是一项艰巨的任务?
最佳答案
有时获取最新版本可能非常有用 - 例如,如果您经常发布自己的依赖项。
你可以像这样获取最新版本
compile "junit:junit:+"
或者最好至少指定主要版本,例如
compile "junit:junit:4.+"
关于java - Gradle - 获取依赖项的最新版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38030341/