Steps:

ARTIFACTORY: How to create a maven build using Azure DevOps and push it to Artifactory with Build info

AuthorFullName__c
Manojkumar M
articleNumber
000005559
ft:sourceType
Salesforce
FirstPublishedDate
2023-01-23T10:13:11Z
lastModifiedDate
2023-01-23
VersionNumber
1
1. Create a new organization in Azure DevOps as below.
User-added image

User-added imageUser-added imageUser-added image


2. Once the organization is created, please go to the Marketplace and install the JFrog azure devops extension as below.

User-added imageUser-added image

For more information please refer to the below URL’s.
3. As a next step create a project under the organization by clicking the new project button as in the screenshot below and provide the name and its private or public project.

User-added image


4. Now we can create a pipeline by going to the pipelines. Please check the below screenshot

User-added image


5. Create a new pipeline by clicking the new pipeline button. It will ask you to select where your code is and all, basically the source code. Select GitHub or any SCM as your source code provider and then select the repository name. Once you complete the authentication, it will create a basic template.

User-added image
User-added image
User-added image
User-added image
User-added image

User-added image


6. We need to create the Artifactory and GitHub connections as below. These will be used to authenticate Azure DevOps with Artifactory and also the maven which will be used in the tasks.

User-added image

In order to configure the JFrog extension and the GitHub, go to the service connections option and search for JFrog and GitHub as below.
Select the JFrog Artifactory V2 for setting up Artifactory with Azure DevOps.

User-added image

For Artifactory, please fill in the following details and verify the connection. If it’s successful, save the same.

User-added image

User-added image
Sample pipeline.yaml file
# Maven
# Build your Java project and run tests with Apache Maven.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/java


trigger:
- master


pool:
 vmImage: ubuntu-latest


steps:
- task: Maven@4
 inputs:
   mavenPomFile: 'maven-examples/maven-example/pom.xml'
   goals: 'clean deploy'
   publishJUnitResults: true
   testResultsFiles: '**/surefire-reports/TEST-*.xml'
   javaHomeOption: 'JDKVersion'
   mavenVersionOption: 'Default'
   mavenAuthenticateFeed: true
   effectivePomSkip: false
   sonarQubeRunAnalysis: false


- task: Bash@3
 inputs:
   targetType: 'inline'
   script: 'env | sort'


- task: JFrogPublishBuildInfo@1
 inputs:
   artifactoryConnection: 'mk-jfrog-artifactory-hts'
   buildName: '$(Build.DefinitionName)'
   buildNumber: '$(Build.BuildNumber)'

7. As a next step run the build by clicking the run button.

User-added image


8. The “displayNames” are added manually as they are not generated by the task. This will show the Display names of the Tasks. If not defined, it will show the name of the Tasks as the Display names.

User-added image

This will push the build to the maven repository in Artifactory with the build info.