How to upload a standalone POM to Azure artifacts?

85 views Asked by At

Previously I have successfully uploaded the POM file to Azure Artifacts using

mvn  org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file     
-Dpackaging=jar    
-DrepositoryId=repoID    
-Durl=https://pkgs.dev.azure.com/path    
-DgroupId=groupId    
-DartifactId=artifactId    
-Dversion=version     
-Dfile=artifactId-version.jar
-DpomFile=artifactId-version.pom

This works very well, but the problem is I have to now upload an artifact with only POM and without JAR https://repository.jboss.org/org/jboss/resteasy/resteasy-jaxrs-all/3.0.19.Final/

I tried this but it is failing

mvn  org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file    
-Dpackaging=jar       
-DrepositoryId=repoID       
-Durl=https://pkgs.dev.azure.com/path    
-DgroupId=org.jboss.resteasy     
-DartifactId=resteasy-jaxrs-all        
-Dversion=3.0.19.Final     
-DpomFile=resteasy-jaxrs-all-3.0.19.Final.pom    

I am getting the following error

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- deploy:2.4:deploy-file (default-cli) @ standalone-pom ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.793 s
[INFO] Finished at: 2024-01-25T16:05:39+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file (default-cli) on project standalone-pom: The parameters 'file' for goal org.apache.maven.plugins:maven-deploy-plugin:2.4:deploy-file are missing or invalid -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException
1

There are 1 answers

7
Ziyang Liu-MSFT On

file is a required parameter in Apache Maven Deploy Plugin. See the detailed info from deploy:deploy-file. To publish an artifact with only pom and without jar, you can change the value of packaging to pom and set file to your pom file. For example,

mvn deploy:deploy-file -Dpackaging=pom -DrepositoryId=YourRepoID -DgroupId=YourGroupID -DartifactId=YourArtifactID -Dversion=7.0-SNAPSHOT -DpomFile=pom.xml -Dfile=pom.xml

Checking the package in Azure artifact, only pom is published. enter image description here