skip to Main Content

I am trying to do maven clean install in azure DevOps and publish the artifacts into jfrog.
However my project is having dependencies. If I run locally by adding jfrog credentials in settings.xml its working, when I try this in azure devops pipeline its failing as it failing to download the dependencies from jfrog.

Here is my YAML Code

trigger:
- master


pool:
 vmImage: ubuntu-latest
steps:
- task: Maven@3
 inputs:
   mavenPomFile: 'pom.xml'
   goals: 'clean deploy'
   publishJUnitResults: true
   testResultsFiles: '**/surefire-reports/TEST-*.xml'
   javaHomeOption: 'JDKVersion'
   mavenVersionOption: 'Default'
   mavenAuthenticateFeed: true
   effectivePomSkip: false



- task: JFrogPublishBuildInfo@1
 inputs:
   artifactoryConnection: 'Token-'
   buildName: '$(Build.DefinitionName)'
   buildNumber: '$(Build.BuildNumber)'

This is my pipeline error
enter image description here

what should i do in-order to achieve this. How can I download the dependencies from jfrog artifactory during my build and publish back to jfrog.

2

Answers


  1. You can use the JFrog Maven task from the extension JFrog instead of the Maven@3 task.

    The JFrog Maven task allows triggering Maven builds, while resolving dependencies and deploying artifacts from and to Artifactory. The task uses the configured JFrog Artifactory V2 service connection. The task can also be configured to capture build-info and store the downloaded and uploaded artifacts as build dependencies and build artifacts. The captured build-info can be later published to Artifactory using the JFrog Publish Build-Info task.

    enter image description here

    Login or Signup to reply.
  2. Based on your description, you have defined the Jfrog credentials in the settings.xml. And it can work on your local machine.

    In Azure DevOps, you can upload the settings.xml to repo and specify the settings.xml file in the maven task.

    For example: options: '-s settings.xml'

    trigger:
    - master
    
    
    pool:
     vmImage: ubuntu-latest
    steps:
    - task: Maven@3
     inputs:
       mavenPomFile: 'pom.xml'
       goals: 'clean deploy'
       options: '-s filepath/settings.xml'
       publishJUnitResults: true
       testResultsFiles: '**/surefire-reports/TEST-*.xml'
       javaHomeOption: 'JDKVersion'
       mavenVersionOption: 'Default'
       mavenAuthenticateFeed: true
       effectivePomSkip: false
    
    
    - task: JFrogPublishBuildInfo@1
     inputs:
       artifactoryConnection: 'Token-'
       buildName: '$(Build.DefinitionName)'
       buildNumber: '$(Build.BuildNumber)'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search