MAVEN


 首先,上网搜索,安装好MAVEN,这里不做过多的介绍,可以参见这里 MAVEN的配置,网上很多资料,这篇文章,主要分享一下我们项目的setting.xml的配置,以及我对配置的理解,因为光看网上的配置,有些东西还是不太好理解。



<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">


  <!-- 这里配置的本地仓库的位置,就是从MAVEN上面同步过来的JAR包放置的位置,很好理解 -->

<localRepository>D:\sofeware\java\apache-maven-3.0.4\repo</localRepository>


          <!-- 这段我理解,MAVEN可以看成SC的方式,这段表示,如果你做S的话,这是你对外的名字,这段在我们项目并没有什么意义,因为我们只是从镜像上下JAR-->

<servers>

<server>

<id>deployment</id>

<username>deployment</username>

<password>deployment</password>

</server>

</servers>

          <!-- 镜像,重点来了,定义了镜像的ID和镜像位置,这个ID在之后profile会用到

mirrorOf:此镜像指向的服务id, *表示全部

   -->

<mirrors> <mirror> <id>xiaozhao</id> <mirrorOf>*</mirrorOf> <url>http://admin.xiaozhao.renren.com/nexus/content/groups/public/</url> </mirror>

</mirrors>



 <!--  

我对profile的理解是,对镜像的一些信息的描述

定义了2个库,这个库在你本地pom.xml中是有配置的,

可以定义你提交的JAR是开发库还是插件库,是正式版本还是测试版本

 -->


<profiles>

<profile>

<id>nexus</id>

<!-- 开发库的定义 -->

<repositories>

<repository>

<!-- 对应上面镜像的ID -->

<id>xiaozhao </id>

<url>http://central</url>

<!-- 发布版本,是否能下载正式发布的版本 -->

<releases>

<enabled>true</enabled>

</releases>

<!-- 测试版本,是否能下载测试的版本 -->

<snapshots>

<enabled>true</enabled>

</snapshots>

</repository>

</repositories>

<!-- 插件开发库-->

<pluginRepositories>

<pluginRepository>

<id>xiaozhao </id>

<url>http://central</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>true</enabled>

</snapshots>

</pluginRepository>

</pluginRepositories>

</profile>


</profiles>


<!-- 激活激活 -->

<activeProfiles>

    <!-- 对应上面镜像的ID -->

<activeProfile>xiaozhao</activeProfile>

</activeProfiles>

</settings>


    如果你有多个镜像,只要配置多次<mirror ><profile ><activeProfile >即可

    关于测试库,正式库的理解,其实在正式项目里,一般很少去这么区分,我们的项目,除了基础的JAR外,其他人写的项目基本都是测试版本,这点只需要知道,你提交的JAR是正式版本还是测试版本,是可以再pom.xml中配置的即可。


这篇文章不错http://blog.csdn.net/uohzoaix/article/details/7035302 ,上面的讲解比较全,但是我开始看的时候,还是有些不太理解,这篇文章,是把我的理解大致说了一下。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值