To store External JAR into your Local Repository of Maven .
1. First you need to modify the " settings.xml " which is present with in the " conf " folder of maven installed folder .
<settings xmlns="http://maven.apache. org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/ 2001/XMLSchema-instance"
xsi:schemaLocation="http:// maven.apache.org/SETTINGS/1.0. 0 http://maven.apache.org/xsd/ settings-1.0.0.xsd" >
localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ~/.m2/repository
< localRepository> /opt/apache-maven-3.0.4/repositoryfolder </localRepository>
You need to create " repositoryfolder " inside the maven installed folder .
NOTE : if you are creating a folder in Linux OS then you need to change the permissions to that folder , you need to change the ownership to the current user .
ex : chown username : username repositoryfolder
If the first step is already done then you can continue from the second step.
2. To use the External JAR's ,the External JAR's must be placed in the local repository in the correct place in order for it to be correctly picked up by Maven. To make this easier, and less error prone, we have provide a goal in the install plug-in which should make this relatively painless.
To install a External JAR in the local repository use the following command :
After doing this it will be use to download the External JAR file into your local Repository .
3. Modify the pom.xml file
After doing the above steps you need to modify the " pom.xml " file like this
1. First you need to modify the " settings.xml " which is present with in the " conf " folder of maven installed folder .
<settings xmlns="http://maven.apache.
xmlns:xsi="http://www.w3.org/
xsi:schemaLocation="http://
localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ~/.m2/repository
< localRepository> /opt/apache-maven-3.0.4/repositoryfolder </localRepository>
You need to create " repositoryfolder " inside the maven installed folder .
NOTE : if you are creating a folder in Linux OS then you need to change the permissions to that folder , you need to change the ownership to the current user .
ex : chown username : username repositoryfolder
2. To use the External JAR's ,the External JAR's must be placed in the local repository in the correct place in order for it to be correctly picked up by Maven. To make this easier, and less error prone, we have provide a goal in the install plug-in which should make this relatively painless.
To install a External JAR in the local repository use the following command :
ex :
mvn install:install-file -Dfile=d:\myfolder\myjar.jar
-DgroupId=com.mygroup -DartifactId=myjar -Dversion=1.0.0
-Dpackaging=jar
After doing this it will be use to download the External JAR file into your local Repository .
3. Modify the pom.xml file
After doing the above steps you need to modify the " pom.xml " file like this
ex :
<dependency>
<groupId>
<artifactId>myjar</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>
com.mygroup
</groupId><artifactId>myjar</artifactId>
<version>1.0.0</version>
</dependency>
No comments:
Post a Comment