javaartifactoryartifactsmaven-deploy-pluginremote-repository

Deploying artifacts built by maven to repository


I want to deploy artifacts to remote repository. My current pom is configured to deploy a jar. I also have .json config file which gets created under target folder in my project along with .jar during the build. I would like to deploy both .jar and .json to remote repository.

Method 1 : Added DistributionManagement part to my pom.xml and server part to my settings.xml as per below post and ran mvn deploy. This copied only .jar file to my remote repository.

How to configure Maven2 to publish to Artifactory?

Method 2 : Was able to push both .jar and .json through command line goal using:

mvn org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M2:deploy-file -Durl=<url-of-the-repository-to-deploy> \
-DrepositoryId=some.id \
-Dfile=my-project/target/.jar \
-DpomFile=my-project/pom.xml \
-Dfiles=my-project/target/test-1.0.0-SNAPSHOT.jar,my-project/target/test-1.0.0-SNAPSHOT.json \
-Dclassifiers=debug,site \
-Dtypes=jar,json

But I'd like to do this outside the command line. Please let me know if there is any way to update this in pom.xml and deploy both .json and .jar files to remote repository. Thanks in advance.


Solution

  • I was able to push .json file with <build-helper-maven-plugin>. Link for reference: https://www.mojohaus.org/build-helper-maven-plugin/usage.html