Tuesday, October 10, 2017

Install jar in local Maven directory

I'm not sure why I couldn't find an easy reference on what to change in a pom.xml file to install a jar in the local Maven repository. Lots of complicated command lines (a few of which actually worked) and little else. I'm not sure why everyone feels the need to make things more complicated than they are. Regardless, here's what worked for me.
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-install-plugin</artifactId>
  <version>2.5.1</version>
  <configuration>
    <file>${basedir}/target/${artifactId}-${version}.jar</file>
  </configuration>
</plugin>
A mvn install:install-file then does the trick.

No comments: