| ms.topic | include |
|---|---|
| ms.service | azure-devops-artifacts |
| ms.author | rabououn |
| author | ramiMSFT |
| ms.date | 07/01/2024 |
::: moniker range="azure-devops"
-
Sign in to your Azure DevOps organization, and then navigate to your project.
-
Select Artifacts, and then select your feed from the dropdown menu.
-
Select Connect to feed, and then select Maven from the left navigation area.
-
If this is your first time using Azure Artifacts with Maven, make sure you've installed the prerequisites. Otherwise select Get the tools in the top-right corner to install them.
-
Follow the instructions in the Project setup section to set up your pom.xml and settings.xml files. Your files should resemble the following examples:
-
pom.xml:
<repositories> <repository> <id>MavenDemo</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>MavenDemo</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>
-
settings.xml:
<servers> <server> <id>MavenDemo</id> <username><ORGANIZATION_NAME></username> <password>[PERSONAL_ACCESS_TOKEN]</password> </server> </servers>
-
-
Generate a Personal Access Token with Packaging > Read & write scope, and then paste it into the
<password>tag.
::: moniker-end
::: moniker range="azure-devops-2020 || azure-devops-2022"
-
Sign in to your Azure DevOps collection, and then navigate to your project.
-
Select Artifacts, and then select your feed from the dropdown menu.
-
Select Connect to Feed, and then select Maven from the left navigation pane.
-
If this is your first time using Azure Artifacts with Maven, make sure you've installed the prerequisites, otherwise select Get the tools in the top-right corner to install them.
-
Follow the instructions in the Project setup section to set up your pom.xml and settings.xml files. Your files should resemble the following examples:
-
pom.xml:
<repositories> <repository> <id>MavenDemo</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>MavenDemo</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>
-
settings.xml:
<servers> <server> <id>MavenDemo</id> <username><COLLECTION_NAME></username> <password>[PERSONAL_ACCESS_TOKEN]</password> </server> </servers>
-
-
Generate a Personal Access Token with Packaging > Read & write scope, and then paste it into the
<password>tag.
::: moniker-end
::: moniker range="azure-devops-2019"
-
Sign in to your Azure DevOps collection, and then navigate to your project.
-
Select Artifacts, and then select your feed.
-
Select Connect to Feed, and then select Maven from the left navigation pane.
-
Select Generate Maven Credentials and add the credentials to your user settings.xml file inside the
<servers>tag. Your file should look like the following example:<servers> <server> <id>server-2019-defaultcollection-demo</id> <username><FEED_NAME></username> <password>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</password> </server> </servers>
-
Add the second snippet to your project's pom.xml inside both the
<repositories>and<distributionManagement>tags. Your file should look like the following example:<repositories> <repository> <id>server-2019-defaultcollection-demo</id> <url>http://<SERVER_NAME>/<COLLECTION_NAME>/_packaging/<FEED_NAME>/maven/v1</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <distributionManagement> <repository> <id>server-2019-defaultcollection-demo</id> <url>http://<SERVER_NAME>/<COLLECTION_NAME>/_packaging/<FEED_NAME>/maven/v1</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </distributionManagement>
::: moniker-end