jfrog / jenkins-artifactory-plugin

Jenkins artifactory plugin
http://jenkins-ci.org/
116 stars 188 forks source link

After upgrading Jenkins Artifactory Plugin from 4.0.0 to higher version(4.0.1-4.0.3), Gradle build fails to resolve dependencies from flatDir #921

Open sanjayc-jfrog opened 8 months ago

sanjayc-jfrog commented 8 months ago

Describe the bug After upgrading Jenkins Artifactory Plugin from 4.0.0 to higher version(4.0.1-4.0.3), Gradle build fails to resolve dependencies from flatDir. The same build was working fine with 4.0.0 and older version.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':runtimeClasspath'.
  The project declares repositories, effectively ignoring the repositories you have declared in the settings.
  You can figure out how project repositories are declared by configuring your build to fail on project repositories.
  See https://docs.gradle.org/7.2/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories for details.
   > Could not find :simple-jar:.
     Required by:
         project :

To Reproduce

repositories {
    jcenter()
    flatDir {
        dirs 'lib'
    }
}

Expected behavior The build should able to resolve the dependencies from flatDir(dependencies based on local file system directories).

Versions

steven-aerts commented 7 months ago

We are seeing this problem too when configuring a local maven repository like this:

repositories {
    maven {
        url "/path/to/local/maven/repository/"
    }
}
steven-aerts commented 7 months ago

We found a workaround for this issue by removing the resolver from the jenkins gradle script. So we removed, from our Jenkinsfile:

- gradle.resolver repo:'repo-libs-local', server: server

Before version 4.0, this resolver configuration seems to be an additional resolver configuration, next to existing resolvers, now it became a unique resolver overriding existing resolvers.

We agree that this is not an optimal solution, and will not work in all cases.

RobiNino commented 3 months ago

Hi @sanjayc-jfrog @steven-aerts , Jenkins Artifactory Plugin 4.0.8 was just released and includes a fix for this issue. We'd appreciate your feedback for it.