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

1

5

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?

Phocine answered 3/8, 2021 at 21:53 Comment(1)
The version 1.0.0 can not access because only 1.0.1 etc. do exist... That's the issue. You have to use a different version.Homogeny
N
12

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/'
    }
}
Nil answered 4/8, 2021 at 8:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.