Maven settings.xml配置理解

[b]Maven settings.xml配置理解[/b]


<?xml version="1.0" encoding="UTF-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>D:\mavenTest\repo</localRepository>

<!--
//当插件的组织Id(groupId)没有显式提供时,供搜寻插件组织Id(groupId)的列表。
//该元素包含一个pluginGroup元素列表,每个子元素包含了一个组织Id(groupId)。
//当我们使用某个插件,并且没有在命令行为其提供组织Id(groupId)的时候,Maven就会使用该列表。
//默认情况下该列表包含了org.apache.maven.plugins。
-->
<pluginGroups>
</pluginGroups>

<!--
//用来配置不同的代理,多代理profiles可以应对笔记本或移动设备的工作环境:通过简单的设置profile id就可以很容易的更换整个代理配置。
-->
<proxies>
</proxies>

<!--
//项目发布到私服配置,
//配置服务端的一些设置(提供连接上服务器必要的信息),因为连接服务器要认证,这里就是配置认证信息
-->
<servers>
<server>
<!--
//这是server的id(注意不是用户登陆的id),该id与distributionManagement(pom.xml文件中)中repository元素的id相匹配。
-->
<id>nexus-releases</id>
<!--
//鉴权用户名。鉴权用户名和鉴权密码表示服务器认证所需要的登录名和密码。
-->
<username>xing</username>
<password>123456</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>xing</username>
<password>123456</password>
</server>
</servers>

<!--
//为仓库列表配置的下载镜像列表。就是本地没有jar时,到这里的服务器中去进行下载回本地仓库中
-->
<mirrors>
<mirror>
<!--
//该镜像的唯一标识符。id用来区分不同的mirror元素。名字由你改
-->
<id>public</id>
<!--
//被镜像的服务器的id。例如,如果我们要设置了一个Maven中央仓库(http://repo1.maven.org/maven2)的镜像,
//就需要将该元素设置成central。这必须和中央仓库的id central完全一致。
//*表示匹配所有远程仓库。
//被镜像的服务器的id。就是你想镜像的服务器上仓库ID
-->
<mirrorOf>*</mirrorOf>
<!--
//该镜像的URL。构建系统会优先考虑使用该URL,而非使用默认的服务器URL。被镜像的URL由镜像服务器那里进行配置
-->
<url>http://localhost:8081/nexus/content/groups/public</url>
</mirror>
</mirrors>

<!--
//远程仓库信息的一种参数描述
-->
<profiles>
<profile>
<!--//该配置的唯一标识符。 -->
<id>nexus</id>
<!--
//远程仓库列表,它是Maven用来填充构建系统本地仓库所使用的一组远程项目。
-->
<repositories>
<repository>
<!--//远程仓库唯一标识-->
<id>public</id>
<!--//远程仓库名称 -->
<name>Public Repositories</name>
<url>http://localhost:8081/nexus/content/groups/public</url>
<!--
//如何处理远程仓库里快照版本的下载。有了releases和snapshots这两组配置,
//POM就可以在每个单独的仓库中,为每种类型的构件采取不同的策略。例如,
//可能有人会决定只为开发目的开启对快照版本下载的支持。
//参见repositories/repository/releases元素
-->
<snapshots>
<enabled>true</enabled>
</snapshots>
<!--//如何处理远程仓库里发布版本的下载-->
<releases>
<!--//true或者false表示该仓库是否为下载某种类型构件(发布版,快照版)开启。 -->
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<!--
//发现插件的远程仓库列表。仓库是两种主要构件的家。第一种构件被用作其它构件的依赖。这是中央仓库中存储的
//大部分构件类型。另外一种构件类型是插件。Maven插件是一种特殊类型的构件。由于这个原因,插件仓库独立于其
//它仓库。pluginRepositories元素的结构和repositories元素的结构类似。每个pluginRepository元素指定一个
//Maven可以用来寻找新插件的远程地址。
-->
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>Public Repositories</name>
<url>http://localhost:8081/nexus/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>

<!--
//手动激活profiles的列表,按照profile被应用的顺序定义activeProfile。 该元素包含了一组activeProfile元素,每个activeProfile都含有一个profile id。
//表示那些Profile是可用的,不在列表的表示不能用
//激活的profile会将仓库配置应用到项目中去。
-->
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>

</settings>



参考原文(setting.xml详解):[url]http://www.cnblogs.com/yangxia-test/p/4409736.html[/url]
参考原文(Maven settings配置中的mirrorOf):[url]http://blog.csdn.net/isea533/article/details/21560089[/url]
参考原文(profile介绍):[url]http://elim.iteye.com/blog/1900568[/url]
参考原文(setting.xml配置文件详解):[url]http://blog.csdn.net/u012152619/article/details/51485152[/url]
参考原文(mirror和repository 区别):[url]http://blog.csdn.net/caomiao2006/article/details/40401517[/url]


[b]使用例子看附件:[/b]
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值