Why can't Gradle resolve org.connectbot.jbcrypt:jbcrypt:1.0.0 from the Maven Central Repository?

1.4k Views Asked by At

I'm using Gradle 6.9 and here is my build.gradle file:

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()
}

This is the error message I'm getting:

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 

What's odd is that the 1.0.0 artifact doesn't show up at https://repo.maven.apache.org/maven2/org/connectbot/jbcrypt/. I also noticed that the urls don't quite match either. Like if I try to get v1.0.1 it doesn't resolve either because it expects an extra "jbcrypt" for the group name.

I have this problem even when using the latest jenkins-war release (2.304).

What's going on?

1

There are 1 best solutions below

0
agabrys On BEST ANSWER

You have to add the Jenkins public repository to your configuration. It contains all libraries available in the releases repository and all required dependencies.

The file exists: 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/'
    }
}