Blog Post

Healthcare and Life Sciences Blog
1 MIN READ

The most common way to publish custom jar files as a Maven artifact in Azure DevOps

Jaswant_Singh's avatar
Jaswant_Singh
Icon for Microsoft rankMicrosoft
May 20, 2024

This is how you can publish your custom jar files as Maven artifacts and use them as dependencies in your projects:

  1. Make sure you have an Azure Artifact feed in Azure DevOps or create one if needed:

     

  2. The command below will generate a Maven artifact. Please upload the pom.xml and jar file to the Azure DevOps Repo if you don't have one ready:                                                                                                    mvn -B archetype:generate -DarchetypeGroupId="org.apache.maven.archetypes" -DgroupId="MyGroup" -DartifactId="myFirstApp"                                                
  3. From the "Connect to feed" in Azure DevOps, select the Maven, and copy the <repository> information:

     
  4. Paste <repository> information from the last step, into your pom.xml file twice in <repositories> and <distributionManagement> tags

     

  5. Create a pipeline in Azure DevOps:  
  6. You can also use settings.xml file to authenticate the Azure DevOps Maven feed in your pipeline.                                                                                      
  7. Configure the feed permission in case of access related issues 
  8. Select the Packages from your feed in Azure DevOps, and copy the contents of the <dependency> element:
  9. Paste the <dependency> element content copied in the last step, inside the <dependencies> element of your project pom.xml file.                               
  10. Run "mvn install" from the directory that contains your project pom.xml file.
Updated May 20, 2024
Version 1.0
No CommentsBe the first to comment