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

Allow maven builds to be configured to use repository local to workspace

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 2.9.2
    • Fix Version/s: None
    • Component/s: Maven3
    • Labels:
      None

      Description

      I was not able to determine a way to configure artifactory plugin via Jenkinsfile to use a maven repository local to the workspace.

      It uses the repository in the Jenkins' users home directory which causes pollution between jobs as we're using the multibranch pipeline plugin. In Manage Jenkins / Configure System, I have Maven Project Configuration configured to use Local Maven Repository of "Local to the workspace".

      Due to this issue, I cannot use Artifactory plugin. Instead of having separate pipeline stages with build, test, and deploy, I'm running a single stage with mvn deploy.

      Here is approximate Jenkinsfile I'd like to use if I could configure repository local to workspace:

      node {
          def server = Artifactory.server 'artifactory'
          def rtMaven = Artifactory.newMavenBuild()
       
          stage('Checkout') {
              checkout scm
          }
       
          stage 'Artifactory configuration' 
              rtMaven.tool = 'Maven 3.3.9'
              rtMaven.deployer snapshotRepo:'snapshots-maven-local', server: server
              rtMaven.resolver snapshotRepo:'maven', releaseRepo:'maven', server: server
              def buildInfo = Artifactory.newBuildInfo()
       
          stage 'Maven build' 
              rtMaven.run pom: 'pom.xml', goals: 'clean install -DskipTests', buildInfo: buildInfo
       
          stage 'Maven test' 
              rtMaven.run pom: 'pom.xml', goals: 'surefire:test', buildInfo: buildInfo
       
          stage 'Maven deploy' 
              server.publishBuildInfo buildInfo
      }
      

        Attachments

          Activity

            People

            • Assignee:
              yahavi Yahav Itzhak
              Reporter:
              jon.gunnip Jon Gunnip
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: