We have a number of third party dependencies that aren\'t hosted anywhere. For each of these we have a jar file that we\'d like to be able to install and/or deploy to our reposi
Ok, I found a solution that allows me to run just mvn install
or mvn deploy
and have the jar file installed to the local or remote repository. Inspired by a post to the maven-users list and using the build-helper plugin, in the parent pom, I have:
org.codehaus.mojo
build-helper-maven-plugin
1.5
attach-artifacts
package
attach-artifact
${artifactId}-${version}.jar
jar
And then in the child poms, I have:
pom
...
...
...
...
org.codehaus.mojo
build-helper-maven-plugin
Some of the pieces of this that initially tripped me up:
attach-artifact
execution should be under
so it doesn't get executed if you mvn install
or mvn deploy
the parent pom.build-helper-maven-plugin
under the build plugins so that code from the parent
gets run.pom
because you can't add a jar to an artifact if it has the same name as the artifact.The only downside I see to this approach is that the artifact gets deployed as type pom
instead of type jar
. But I haven't seen any real consequences of that.