jenkins-artifactory-plugin icon indicating copy to clipboard operation
jenkins-artifactory-plugin copied to clipboard

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

Open sanjayc-jfrog opened this issue 1 year ago • 3 comments

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

  • Create a Jenkins Freestyle Project.
  • Configure 'Gradle-Artifactory Integration' as Build environment and update Artifactory Configurations to deploy and resolve dependencies.
  • Next Under Build steps, Select 'clean artifactoryPublish' as task and Configure 'Root Build Script' Directory to the Gradle Project location.
  • Please make sure the build.gradle file in the Gradle Project has below configuration to resolve Dependencies from flatDir.
repositories {
    jcenter()
    flatDir {
        dirs 'lib'
    }
}
  • Then test a build by running it which will fail as it could not resolve dependencies from flatDir.

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

Versions

  • Jenkins Artifactory plugin version: 4.0.3 (upgraded from 4.0.0)
  • Jenkins Version: 2.426.3
  • Jenkins operating system: Centos
  • Artifactory Version: 7.78.3(Saas)

sanjayc-jfrog avatar Feb 12 '24 18:02 sanjayc-jfrog

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

repositories {
    maven {
        url "/path/to/local/maven/repository/"
    }
}

steven-aerts avatar Mar 22 '24 08:03 steven-aerts

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.

steven-aerts avatar Mar 22 '24 13:03 steven-aerts

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.

RobiNino avatar Jul 11 '24 12:07 RobiNino