rpm-maven-plugin: deploying jar and rpm into different repositories

1.8k Views Asked by At

I've got a pom building a jar and packaging it into a rpm using rpm-maven-plugin. The jar is used both as a standalone application and as a dependency of other applications, so I need to deploy both artifacts to our local Nexus. I would like to deploy the jar into the standard maven-releases/maven-snapshots repositories, but the rpm I would like to deploy into a different repository in the same Nexus dedicated to just our RPMS.

My maven knowledge is fairly basic, but I'm not seeing how to do this. I hope it isn't so outside the maven philosophy that I can't, because the separate RPM repository is probably non-negotiable.

Thanks!

1

There are 1 best solutions below

0
On

I had the same situation. My solution was to create a sub-directory/child module specifically for generating the rpms using the rpm plugin (I named the module create-rpms). In that child module I created a maven profile (also named create-rpms) with different distributionManagement elements pointing to the rpm/yum repos. To build my project I thus had 2 maven calls:

"mvn deploy" to generate/upload the jar/war, etc artifacts, "mvn deploy -P create-rpms -f create-rpms/pom.xml" to create/upload the rpms.

This approach also had the benefit of permitting Windows-based developers use regular maven to compile locally, but then use the second maven call on a Linux-based Jenkins server.

Hope this helps.