I have a maven project (in a pipeline) that needs to consume artifacts deployed (via mvn deploy) in another azure pipeline as a dependency.
I am able to upload and download artifacts to Azure devops using command lines like:
az artifacts universal publish \
--organization https://myorg.visualstudio.com \
--scope project \
--project="myproject" \
--feed myfeed \
--name someartifact-1.99.1.jar \
--version 1.99.1 \
--description "snafu" \
--debug \
--path .
and
az artifacts universal download
--organization "https://myorg.visualstudio.com/"
--project "myproject"
--scope project
--feed "myfeed"
--name "someartifact-1.99.1.jar" --version "1.99.1"
--path .
For which the equivalent maven commands should be something like:
mvn deploy:deploy-file -DWHERE="AzureDevops" clean deploy
and
mvn -X -B -s maven-azuredevops-settings.xml
-DWHERE=AzureDevops
-DrepoURL=https://myorg.pkgs.visualstudio.com/myproject/_packaging/myfeed/maven/v1
dependency:get
-Dartifact=com.foobar.blah:someartifact:1.99.1
-Ddest=./clientartifact.jar
Where I have in my maven-azuredevops-settings.xml:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<interactiveMode>false</interactiveMode>
<servers>
<server>
<id>feedname</id>
<username>azureusername</username>
<password>personal access token</password>
</server>
</servers>
</settings>
Likewise, I have the settings recommended on Azure in the pom.xml - though I don't fully grok them.
However I notice some differences. When a package is deployed by maven in a pipeline the Artifact has a big M for maven in front of it when viewed in the feed. It is also listed as:
com.foobar.blah:someartifact 1.9.9
If uploaded with az artifacts
directly it is a plain universal package not a maven package.
A key difference (is it the only one?) is that there is a .pom artifact as well in the same artifact. My maven build creates this and puts it in the local repository but I am not clear how to publish it as part of the same artifact rather than a separate file in the feed.
I also have trouble with project scoped feeds (i.e. with --scope and --project). Maven reports the 401 unauthorized rather than saying a package is missing. I get a 401 if I wget the URL of the repo from command line despite being logged in. This is my main issue at present.
Clearly there are some gaps in my understanding of both Azure and Maven both of which I am new to. Can someone enlighten me as to how to get the maven commands to work properly or alternatively make the azure commands behave equivalently where that is possible.
For context I am trying to debug a pipeline by executing the equivalent commands offline. See also Azure DevOps Pipeline - Maven deploy release only if it does not exist