首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么Gradle不能从Maven中央存储库解析org.connectbot.jbcrypt:jbcrypt:1.0.0?

为什么Gradle不能从Maven中央存储库解析org.connectbot.jbcrypt:jbcrypt:1.0.0?
EN

Stack Overflow用户
提问于 2021-08-03 21:53:16
回答 1查看 249关注 0票数 3

我使用的是Gradle6.9,下面是我的build.gradle文件:

代码语言:javascript
复制
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()
}

这是我收到的错误消息:

代码语言:javascript
复制
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/上。我还注意到urls也不太匹配。例如,如果我尝试获取v1.0.1,它也不能解析,因为它要求组名使用额外的"jbcrypt“。

即使使用最新的jenkins-war发行版(2.304),我也会遇到这个问题。

到底怎么回事?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-08-04 08:32:12

您必须将Jenkins public存储库添加到配置中。它包含releases存储库中所有可用的库和所有必需的依赖项。

文件存在:https://repo.jenkins-ci.org/public/org/connectbot/jbcrypt/jbcrypt/1.0.0/jbcrypt-1.0.0.jar

代码语言:javascript
复制
repositories {
    mavenCentral()
    maven {
        url 'https://repo.jenkins-ci.org/public/'
    }
}
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68643179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档