i have third part jar file which doesn't exist remotely the file located inside the project directory , i want to add this jar into the local repository when i execute mvn install, my current code for doing that
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>myJar1.0</groupId>
<artifactId>myJar1.0</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<file>myJar1.0.jar</file>
</configuration>
</execution>
</executions>
</plugin>
Actually its not so complicated.
There are 2 cases that you need to issue Maven’s command to include a jar into the Maven local repository manually.
Steps:
put your jar somewhere, lets assume its under c:\
:
mvn install:install-file -Dfile=c:\myJar{version}.jar
-DgroupId=YOUR_GROUP -DartifactId=myJar -Dversion={version} -Dpackaging=jar
Now, the "myJar" jar is copied to your Maven local repository.
After installed, just declares the myJar
coordinate in pom.xml.
<dependency>
<groupId>YOUR_GROUP</groupId>
<artifactId>myJar</artifactId>
<version>{version}</version>
</dependency>
Build it, now the "myJar" jar is able to retrieve from your Maven local repository.
NOTE: this example was based on the another example which I encourage you to read for further information.
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