Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure DevOps Services | Azure DevOps Server 2022 | Azure DevOps Server 2020
Azure Artifacts enables developers to publish and restore Maven packages from feeds and public registries such as Maven Central and Google Maven Repository. This article walks you through setting up your Maven project and connecting to an Azure Artifacts feed.
Prerequisites
Product | Requirements |
---|---|
Azure DevOps | - An Azure DevOps organization. - An Azure DevOps project. - An Azure Artifacts feed. - Download and Install Apache Maven. |
Project setup
Sign in to your Azure DevOps organization, and then navigate to your project.
Select Artifacts, select your feed from the dropdown menu, and then select Connect to feed.
In the left navigation pane, select Maven. Make sure you've installed the prerequisites, if not, select Get the tools in the top-right corner to download and install them.
In the Project setup section, copy the
repository
snippet and add it to your pom.xml file within the<repositories>
anddistributionManagement>
sections. Your file should resemble the following:<repositories> <repository> <id>FEED_NAME</id> <url>https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/maven/v1</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <distributionManagement> <repository> <id>FEED_NAME</id> <url>https://pkgs.dev.azure.com/<ORGANIZATION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/maven/v1</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </distributionManagement>
Add the provided snippet to your local settings.xml (located in ${user.home}/.m2):
<servers> <server> <id>FEED_NAME</id> <username><ORGANIZATION_NAME></username> <password>[PERSONAL_ACCESS_TOKEN]</password> </server> </servers>
Generate a Personal Access Token with Packaging > Read & write scopes, and paste it into the
<password>
tag in your settings.xml file.
Sign in to your Azure DevOps collection, and then navigate to your project.
Select Artifacts, select your feed from the dropdown menu, and then select Connect to feed.
In the left navigation pane, select Maven. Make sure you've installed the prerequisites, if not, select Get the tools in the top-right corner to download and install them.
In the Project setup section, copy the
repository
snippet and add it to your pom.xml file within the<repositories>
anddistributionManagement>
sections. Your file should resemble the following:<repositories> <repository> <id>FEED_NAME</id> <url>http://<SERVER_NAME>/<COLLECTION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/maven/v1</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <distributionManagement> <repository> <id>FEED_NAME</id> <url>http://<SERVER_NAME>/<COLLECTION_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/maven/v1</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </distributionManagement>
Add the provided snippet to your local settings.xml (located in ${user.home}/.m2):
<servers> <server> <id>FEED_NAME</id> <username><COLLECTION_NAME></username> <password>[PERSONAL_ACCESS_TOKEN]</password> </server> </servers>
Generate a Personal Access Token with Packaging > Read & write scopes, and paste it into the
<password>
tag in your settings.xml file.
Tip
If your settings.xml
file is shared across your team, you can use Maven to encrypt your passwords.