Total Pageviews

2018/01/10

[Maven] How to use local repository?

Problem
How to use local repository in Maven?

How-To


Approach 1. Add localRepository tag in your settings.xml
1
2
3
4
5
6
7
8
<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>C:\Users\albert\.m2</localRepository>
   
</settings>


Approach 2. Assign -Dmaven.repo.local in command line
1
mvn -o -Dmaven.repo.local=C:\Users\albert\.m2" clean install -Dmaven.test.skip=true -X



Reference
[1] https://stackoverflow.com/questions/9123004/maven-is-it-possible-to-override-location-of-local-repository-via-the-use-of-co

No comments: