1

I am running into problems with gradle while resolving dependencies. Some of my projects uses a core-lib which I provide by my private repository - nexus3. And the weirdest part is, one of this projects resolves the dependency, while the others can't. I have no Idea what I am doing wrong:

This is how I define my gradle repositories:

repositories {
    maven {
        credentials {
            username = "user"
            password = "password"
        }
        url = uri("https://my-nexus-url/repository/group-repo/")
    }
    mavenCentral()
}

This is how the dependency is implemented:

dependencies {
    ...
    implementation("my.lib.core:core:1.0")
    ...
}

This is how is the puiblishing configure block:

publishing {
    publications {
        create<MavenPublication>("maven") {
            groupId = "my.lib.core"
            artifactId = "core"
            version = "1.0"

            from(components["java"])
        }
    }
    repositories {
        maven {
            credentials {
                username = "user"
                password = "password"
            }
            url = uri("https://my-nexus-url/repository/release-repo/")
        }
    }
}

I am also able to download the artifact via nexus web ui and curl. Furthermore already one of these projects is able to implement it. The rest of them throws:

Could not resolve my.lib.core:core:1.0.
Required by:
    project :lib

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

Running gradlew ass --refresh-dependencies works fine and ends with:

Cached resource https://my-nexus-url/repository/group-repo/my/lib/core/core/1.0/core-1.0.jar is up-to-date (lastModified: Tue Mar 08 23:05:19 CET 2022).

WinterMute
  • 145
  • 2
  • 11
  • 2
    I was seeing the same error but for an internal dependency. gradlew ass --refresh-dependencies solved my problem – cunhaf Aug 01 '22 at 09:57

0 Answers0