为什么 Gradle 无法从 Maven 中央存储库解析 org.connectbot.jbcrypt:jbcrypt:1.0.0?
Why can't Gradle resolve org.connectbot.jbcrypt:jbcrypt:1.0.0 from the Maven Central Repository?
我正在使用 Gradle 6.9,这是我的 build.gradle 文件:
plugins {
id "groovy"
id "java"
}
group "com.matthiasdenu"
version "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven {
url 'https://repo.jenkins-ci.org/releases/'
}
}
ext {
jobDslVersion = "1.77"
jenkinsVersion = "2.252"
}
sourceSets {
jobs {
groovy {
srcDirs "jobs"
compileClasspath += main.compileClasspath
}
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
dependencies {
compile("org.jenkins-ci.main:jenkins-war:${jenkinsVersion}"){
// https://github.com/sheehan/job-dsl-gradle-example/issues/87
exclude group: "org.jenkins-ci.ui", module: "bootstrap"
}
}
test {
useJUnitPlatform()
}
这是我收到的错误消息:
Execution failed for task ':compileTestGroovy'.
> Could not resolve all files for configuration ':testCompileClasspath'.
> Could not find org.connectbot.jbcrypt:jbcrypt:1.0.0.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/connectbot/jbcrypt/jbcrypt/1.0.0/jbcrypt-1.0.0.pom
- https://repo.jenkins-ci.org/releases/org/connectbot/jbcrypt/jbcrypt/1.0.0/jbcrypt-1.0.0.pom
Required by:
project : > org.jenkins-ci.main:jenkins-war:2.252 > org.jenkins-ci.main:jenkins-core:2.252
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
奇怪的是 1.0.0 工件没有出现在 https://repo.maven.apache.org/maven2/org/connectbot/jbcrypt/。我还注意到网址也不太匹配。就像我尝试获取 v1.0.1 它也不会解析,因为它需要一个额外的“jbcrypt”作为组名。
即使使用最新的 jenkins-war 版本 (2.304),我也有这个问题。
怎么回事?
您必须将 Jenkins public
存储库添加到您的配置中。它包含 releases
存储库中可用的所有库和所有必需的依赖项。
文件存在:https://repo.jenkins-ci.org/public/org/connectbot/jbcrypt/jbcrypt/1.0.0/jbcrypt-1.0.0.jar
repositories {
mavenCentral()
maven {
url 'https://repo.jenkins-ci.org/public/'
}
}
我正在使用 Gradle 6.9,这是我的 build.gradle 文件:
plugins {
id "groovy"
id "java"
}
group "com.matthiasdenu"
version "1.0-SNAPSHOT"
repositories {
mavenCentral()
maven {
url 'https://repo.jenkins-ci.org/releases/'
}
}
ext {
jobDslVersion = "1.77"
jenkinsVersion = "2.252"
}
sourceSets {
jobs {
groovy {
srcDirs "jobs"
compileClasspath += main.compileClasspath
}
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
dependencies {
compile("org.jenkins-ci.main:jenkins-war:${jenkinsVersion}"){
// https://github.com/sheehan/job-dsl-gradle-example/issues/87
exclude group: "org.jenkins-ci.ui", module: "bootstrap"
}
}
test {
useJUnitPlatform()
}
这是我收到的错误消息:
Execution failed for task ':compileTestGroovy'.
> Could not resolve all files for configuration ':testCompileClasspath'.
> Could not find org.connectbot.jbcrypt:jbcrypt:1.0.0.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/org/connectbot/jbcrypt/jbcrypt/1.0.0/jbcrypt-1.0.0.pom
- https://repo.jenkins-ci.org/releases/org/connectbot/jbcrypt/jbcrypt/1.0.0/jbcrypt-1.0.0.pom
Required by:
project : > org.jenkins-ci.main:jenkins-war:2.252 > org.jenkins-ci.main:jenkins-core:2.252
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
奇怪的是 1.0.0 工件没有出现在 https://repo.maven.apache.org/maven2/org/connectbot/jbcrypt/。我还注意到网址也不太匹配。就像我尝试获取 v1.0.1 它也不会解析,因为它需要一个额外的“jbcrypt”作为组名。
即使使用最新的 jenkins-war 版本 (2.304),我也有这个问题。
怎么回事?
您必须将 Jenkins public
存储库添加到您的配置中。它包含 releases
存储库中可用的所有库和所有必需的依赖项。
文件存在:https://repo.jenkins-ci.org/public/org/connectbot/jbcrypt/jbcrypt/1.0.0/jbcrypt-1.0.0.jar
repositories {
mavenCentral()
maven {
url 'https://repo.jenkins-ci.org/public/'
}
}