Deploying non Maven based module src and tests jar to Archiva in a single transaction

蓝咒 提交于 2019-12-24 12:21:08

问题


Is it possible to use Maven deploy:deploy-file or similar to deploy your main src jar snapshot and the test src jar snapshot to Archiva so that it results in a single entry?

Currently I have an Ant project which has jars I want publishing to Archiva and here is how I am doing it:

<!--Main Src Jar-->

<exec executable="${maven.bin}" dir="../lib">           
  <arg value="deploy:deploy-file" />
  <arg value="-DgroupId=com.xxx.gt" />
  <arg value="-DartifactId=${ant.project.name}" />              
  <arg value="-Dversion=${manifest.implementation.version}-SNAPSHOT" />             
  <arg value="-Dpackaging=jar" />               
  <arg value="-Dfile=../lib/${ant.project.name}-${manifest.implementation.version}-SNAPSHOT.jar" />             
  <arg value="-Durl=http://archiva.xxx.com/archiva/repository/snapshots" />             
  <arg value="-DrepositoryId=snapshots" />
</exec>         

<!--Test Src Jar-->

<exec executable="${maven.bin}" dir="../lib">           
  <arg value="deploy:deploy-file" />
  <arg value="-DgroupId=com.xxx.gt" />
  <arg value="-DartifactId=${ant.project.name}" />              
  <arg value="-Dversion=${manifest.implementation.version}-SNAPSHOT" />             
  <arg value="-Dpackaging=jar" />               
  <arg value="-Dfile=../lib/${ant.project.name}-${manifest.implementation.version}-SNAPSHOT-tests.jar" />               
  <arg value="-Durl=http://archiva.xxx.com/archiva/repository/snapshots" />             
  <arg value="-DrepositoryId=snapshots" />
  <arg value="-Dclassifier=tests" />                    
</exec>

The above Ant script will result in two snapshots on Archiva, 1 with the main src jar and the other with the test src jar.

Using mvn deploy on a typical Maven project will group the artifacts together.

Non Grouped Archiva Image

Has a sanpshot entry per deploy:deploy-file command

Grouped Archiva Image

Has a single sanpshot entry grouping src and tests jars.

Here's my earlier post which will help explain how I got to this point.

If anyone knows how to solve this I'd appreciate it.

Thank You


回答1:


I think that the maven-deploy-plugin has evolved a lot. Right now it is possible to deploy multiple files within a single execution. See http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploying-with-classifiers.html for the description.



来源:https://stackoverflow.com/questions/2606554/deploying-non-maven-based-module-src-and-tests-jar-to-archiva-in-a-single-transa

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!