I want to install few jars to my local maven repo with maven-install-plugin. My maven 3.2.1 installation uses version 2.4 of this plugin which requires a lot of parameters to specify. I would like to use version 2.5 that requires less parameters, as mentioned on http://maven.apache.org/plugins/maven-install-plugin/usage.html. If I run mvn install:install-file
from the folder that has a pom.xml file with the following, then it uses version 2.5:
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
Otherwise, it still uses the old plugin. How do I force Maven to use maven-install-plugin version 2.5 (if I run install-file from any folder)?
P.S. How to install third party source and javadoc JARs? does not contain the answer.
Automatic Plugin Version Resolution x used to pick the latest version available where the latest version could either be a release or a snapshot. For the sake of stability, Maven 3. x prefers the latest release version over the latest snapshot version.
However, as previously mentioned, the user may have a need for third-party plugins. Since the Maven project is assumed to have control over the default plugin groupId, this means configuring Maven to search other groupId locations for plugin-prefix mappings. As it turns out, this is simple.
Answered in comments:
Run mvn org.apache.maven.plugins:maven-install-plugin:2.5:install-file. – Aleksandr M Aug 8 '14 at 8:47
Clarification:
Aleksandr M means that this is possible using the install-file
goal of the maven-install-plugin. This requires you to specify the file to be installed using the -file
flag. This is explained in more detail in the maven documentation.
Another alternative is to declare maven-install-plugin
with 2.5.x version inside project's pom.xml
-
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>default-install</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With