Deploy rpm file to Artifactory with maven deploy:deploy-file

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

The maven deploy plugin allows to deploy artifacts and files to your internal repository. If you happen to have a Maven Repository like Sonatype Nexus or JFrog’s Artifactory the plugin is the right choice. This post covers how to deploy a rpm file to Artifactory. The Maven repository itself is not covered here.

First you have to define in your maven project (pom.xml) the deploy-file goal. Replace the properties. Following example is for a rpm generated file with Apache Maven.

    <!-- deploy rpm to artifactory -->
            <!-- must match id of settings.xml of Jenkins -->

Artifactory itself may have a snapshot and release repository, which is expressed through two maven profiles (test and prod).


After the rpm is generated, deploy your rpm within the Jenkinsfile to production if you happen to be on the git master branch, otherwise put it the snapshot repository.

stage('Build: artifactory') {
	if (isMaster) {
		sh "${mvnHome}/bin/mvn rpm:version deploy:deploy-file --activate-profiles prod -Dbuild.number=${BUILD_NUMBER}"
	} else {
		sh "${mvnHome}/bin/mvn rpm:version deploy:deploy-file --activate-profiles test -Dbuild.number=${BUILD_NUMBER}"
Please remember the terms for blog comments.