Installing an artifact with a custom POM

The Apache Maven Install Plugin can include a pre-built custom POM with the artifact in the local repository. Just set the value of the pomFile parameter to the path of the custom POM.

mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=path-to-your-artifact-jar -DpomFile=path-to-pom

If the JAR was built by Apache Maven, it'll contain a pom.xml in a subfolder of the META-INF directory, which will be read by default. In that case, all you need to do is:

mvn org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=<path-to-file>

Note: By using the fully qualified path of a goal, you're ensured to be using the preferred version of the maven-install-plugin. When using mvn install:install-file its version depends on its specification in the pom or the version of Apache Maven.