gpt4 book ai didi

maven - 将Gradle从1.12升级到2.14后找不到快照依赖项

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

gradle1.12升级到2.14后,未标识Maven存储库中依赖项的快照版本。存储库已正确设置,并且maven-metadata.xml和依赖项存在,并且使用gradle的1.xx版本进行构建。从2.xxx的gradle发行说明中也找不到任何内容。有没有人遇到这种情况?
以下是我的build.gradle文件。

// Apply the java plugin to add support for Java
apply plugin: 'java'

// In this section you declare where to find the dependencies of your project
repositories {
// Use 'maven central' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
mavenCentral()
maven {
name = 'Public'
credentials {
username = 'abc'
password = 'abc'
}
url 'http://mydomain/nexus/content/groups/public/'
}

}

// In this section you declare the dependencies for your production and test code
dependencies {
// The production code uses the SLF4J logging API at compile time
compile(

[group: 'com.test.comp', name: 'comp-app-interface', version: "3.0.9_SNAPSHOT"],
[group: 'com.test.comp', name: 'comp-app-common', version: "3.0.10_SNAPSHOT", classifier: 'lib'],
)
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile "junit:junit:4.11"
}

以下是我使用gradle 2.14构建时收到的错误消息:
FAILURE: Build failed with an exception.

\* What went wrong:
Could not resolve all dependencies for configuration ':COMP-Testing- Common:compileClasspath'.

\> Could not find com.test.comp:comp-app-common:3.0.10_SNAPSHOT.
Searched in the following locations:
file:/C:/Users/myname/.m2/repository/com/test/comp/comp-app-common/3.0.10_SNAPSHOT/comp-app-common-3.0.10_SNAPSHOT.pom
file:/C:/Users/myname/.m2/repository/com/test/comp/comp-app-common/3.0.10_SNAPSHOT/comp-app-common-3.0.10_SNAPSHOT-lib.jar
http://example.com/nexus/content/groups/public/com/test/comp/comp-app-common/3.0.10_SNAPSHOT/comp-app-common-3.0.10_SNAPSHOT.pom
http://example.com/nexus/content/groups/public/com/test/comp/comp-app-common/3.0.10_SNAPSHOT/comp-app-common-3.0.10_SNAPSHOT-lib.jar
Required by:
com.test.comp:COMP-Testing-Common:3.0.10



但是,当使用gradle 1.12构建时,它将下载适当的快照。

最佳答案

我发现并解决了这个问题。
由于版本号的格式,Gradle无法识别它们是快照。
例如:当版本号和“快照”之间有下划线时,3.0.9_SNAPSHOT gradle只会查找该版本的依赖项。但是,如果它之间使用短划线而不是下划线(即3.0.9-SNAPSHOT),则gradle将读取maven-metadata.xml并查找最新的快照。
使用gradle 1.xxx版本时,下划线工作正常。

关于maven - 将Gradle从1.12升级到2.14后找不到快照依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38003976/

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