Author |
Topic: Maven -- Configure |
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
Maven -- Configure |
Maven configuration occurs at 3 levels:
Project - most static configuration occurs in pom.xml Installation - this is configuration added once for a Maven installation User - this is configuration specific to a particular user in ${user.home}/.m2/settings.xml
The separation is quite clear - the project defines information that applies to the project, no matter who is building it, while the others both define settings for the current environment.
|
|
|
|
|
|
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
How maven dependency works? or Where do the libraries come from? |
With maven, project finds it's denpedent libraries in the following order:
First locally look at location ${user.home}/.m2/repository/ If not found, then remotely download from http://repo.maven.apache.org/maven2/
|
|
|
|
|
|
|
Alex_Raj member offline |
|
posts: |
99 |
joined: |
05/16/2006 |
from: |
San Jose, CA |
|
|
|
|
|
Change default settings |
Change default local repository in ${user.home}/.m2/settings.xml
<settings>
...
<localRepository>/path/to/local/repo/</localRepository>
...
</settings>
Add a proxy or mirror to remote repository in ${user.home}/.m2/settings.xml
<settings>
...
<localRepository/>
...
<mirrors>
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on repo.mycompany.com</name>
<url>http://repo.mycompany.com/nexus/content/public</url>
<!--This * sends everything else to the above reposiory -->
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
...
</profile>
<profile>
...
</profile>
</profiles>
</settings>
Another advanced example
<settings>
...
<mirrors>
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on repo.mycompany.com</name>
<url>http://repo.mycompany.com/proxy</url>
<mirrorOf>external:*,!foo</mirrorOf>
</mirror>
<mirror>
<id>foo-repository</id>
<name>Foo</name>
<url>http://repo.mycompany.com/foo</url>
<mirrorOf>foo</mirrorOf>
</mirror>
</mirrors>
...
</settings>
|
|
|
|
|
|
|
|