6

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.

MartyIX
  • 27,828
  • 29
  • 136
  • 207
Alexander
  • 847
  • 1
  • 9
  • 18

2 Answers2

8

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.

pjanssen
  • 1,065
  • 13
  • 35
2

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>
Anshul Singhal
  • 1,983
  • 20
  • 25