MAVEN2入门学习心得(2)-仓库相关
MAVEN2的仓库基本可以分为主机仓库、代理仓库、本地仓库。
主机仓库通常是构件的原始存储位置,比如:核心仓库central、Nexus建立的host仓库。
代理仓库通常是主机仓库的中间代理,比如:Nexus中建立的proxy仓库。
本地仓库通常是构件的最终需求位置,一般是用户代码构建的地方。用户在安装完MAVEN2的时候可以改变本地仓库的位置。
我们可以通过如下命令:mvn help:effective-pom 查看最简单的pom.xml配置实际设置仓库情况:
<repositories> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>Maven Repository Switchboard</name> <url>http://repo1.maven.org/maven2</url> </repository></repositories>
<profiles><profile> <id>nexus</id> <repositories> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://localhost:7777/nexus/content/groups/public</url> </repository> </repositories> </profile> <profile> <id>nexus-snapshots</id> <repositories> <repository> <id>nexus-snapshots</id> <name>local private nexus snapshots</name> <url>http://localhost:7777/nexus/content/groups/public-snapshots</url> </repository> </repositories> </profile></profiles>
<activeProfiles> <activeProfile>nexus</activeProfile> <activeProfile>nexus-snapshots</activeProfile> </activeProfiles>
<repositories> <repository> <id>nexus-snapshots</id> <name>local private nexus snapshots</name> <url>http://localhost:7777/nexus/content/groups/public-snapshots</url> </repository> <repository> <id>nexus</id> <name>local private nexus</name> <url>http://localhost:7777/nexus/content/groups/public</url> </repository> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>central</id> <name>Maven Repository Switchboard</name> <url>http://repo1.maven.org/maven2</url> </repository> </repositories>
<mirror> <id>NexusMirror</id> <name>Nexus Public Mirror</name> <url>http://localhost:7777/nexus/content/groups/public</url> <mirrorOf>central</mirrorOf></mirror>