I am having required maven jars at azure artifacts. From there, I have to use and execute my maven project which is java selenium project.
I am going to run my maven project via azure pipelines. I don’t know about how to use the jar from azure artifacts. Can anybody help with this?
Thanks in advance.
You can refer this document Restore Maven packages from your Azure Artifacts feed frist.
Here are the detailed steps:
-
Click the Connect to feed button from your screenshot, and then select Maven from the left navigation area.
-
Follow the instructions in the Project setup section to set up your
pom.xml
file. If you need to test it in your local, you can also setup thesettings.xml
.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>
- Copy the dependency code from the package and add it to your
pom.xml
file - Add MavenAuthenticate@0 and Maven task to your pipeline YAML file to build your project. It will download the package in the build task.
steps:
- task: MavenAuthenticate@0
inputs:
artifactsFeeds: 'TestFeed' #Your feed name
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
goals: 'package'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
mavenVersionOption: 'Default'
mavenOptions: '-Xmx3072m'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
- To deploy your artifacts to your Azure Artifacts feed:
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
goals: 'deploy'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
mavenVersionOption: 'Default'
mavenOptions: '-Xmx3072m'
mavenAuthenticateFeed: true
effectivePomSkip: false
sonarQubeRunAnalysis: false