Uploaded image for project: 'Jenkins Artifactory Plug-in'
  1. Jenkins Artifactory Plug-in
  2. HAP-1307

Jenkins pipeline errors after migrating to 3.5.0 from 3.4.1

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: 4 - Normal
    • Resolution: Done
    • Affects Version/s: 3.5.0
    • Fix Version/s: 3.7.1
    • Component/s: Gradle, Maven3
    • Labels:
      None

      Description

      We recently upgraded the Jenkins Artifactory Plugin from 3.4.1 to 3.5.0 and we started getting errors with our pipeline code when we made the plugin version update. Below are the two errors we have found. We need some help with resolving the two following issues. Based on the release notes I believe this has something to do with the following changes:

      . .Gradle pipeline - support defining snapshot and release repositories. (HAP-1174)
      4. Replace the usage of gradle's maven plugin with the maven-publish plugin. (HAP-1096)

      Issue: 1 When build.gradle contains maven-publish plugin gradle build fails with artifactory gradle step. This seems like it has to do with https://www.jfrog.com/jira/browse/HAP-1096 . Based off that ticket, we updated the build.gradle to use the ‘maven-publish’ plugin but we are still getting the below error. In addition, does this mean if users have ‘maven’ plugin defined in their build.gradle that they’d have to update it to use ‘maven-publish’ plugin?

      Error: FAILURE: Build failed with an exception. 13:17:17 13:17:17 * What went wrong: 13:17:17 Could not get unknown property 'java' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer. 13:17:17

      Test Data:
      build.gradle: (even if only contains this one line)
      apply plugin: 'maven-publish'

      Pipeline code:
      rtGradle = Artifactory.newGradleBuild()
      rtGradle.usesPlugin = false
      rtGradle.deployer.deployMavenDescriptors = true
      rtGradle.deployer.deployIvyDescriptors= false
      rtGradle.deployer server: Artifactory.server("artifactory-test-server"), repo: "snapshot-local"
      rtGradle.deployer.deployArtifacts = false
      rtGradle.useWrapper = true
      rtGradle.run rootDir: ".", buildFile: "build.gradle", switches: "--info", tasks: "clean"

      Issue 2: When using an rtGradle object, we are suddenly getting an error regarding the deployer should have either “repo” defined or both “snapshotRepo” and “releaseRepo” defined. The error message gives off the impression that we should still be able to just set the “repo” for the rtGradle deployer but just setting “repo” is still giving us the following error.

      error - java.lang.Exception: java.lang.RuntimeException: java.io.IOException: The Deployer should be set with either 'repo' or both 'releaseRepo' and 'snapshotRepo' – ExecuteArtifactoryGradleJob

      Pipeline code:
      rtGradle = Artifactory.newGradleBuild()
      if (cdAppProperties.usesGradlePlugin?.toBoolean())

      { rtGradle.usesPlugin = true }

      else

      { rtGradle.usesPlugin = false }

      rtGradle.deployer.deployMavenDescriptors = true
      rtGradle.deployer.deployIvyDescriptors= false

      if (toBuildType == "CI")

      { logger.info("Entered toBuildType CI") rtGradle.deployer server: server, repo: snapshotLocal.toString() }

      else if (toBuildType == "RELEASE")

      { logger.info("Entered toBuildType RELEASE") rtGradle.deployer server: server, repo: releaseLocal.toString() }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yahavi Yahav Itzhak
              Reporter:
              georgejk George Kannathumadam
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: