maven小笔记

Maven小笔记

一、  可选依赖

<option>true/false</option>,是否向下传递。

二、  排除依赖

<exclusions>

<exclusion>

        依赖jar坐标

</exclusion>

</exclusions>,排除继承而来的依赖。

三、  依赖冲突

依赖冲突,即同一个pom.xml文件中,多个不同版本jar的依赖,最终引入最后配置的jar版本;亦或在子pom.xml文件中,重写某个jar依赖,会覆盖父jar依赖。

四、  setting.xml配置解析

<mirrors>

<mirror>

<id>nexus</id>

<!-- *代表所有的jar都到url地址下载,也可以写central -->

<mirrorOf>*</mirrorOf>

<url>私库地址</url>

</mirror>

</mirrors>

------------------------------------分割线--------------------------------------------

<profiles>

       <profile>

            <id>nexus</id>

            <!—所有请求均通过镜像 -->

            <repositories>

          <!--jar 依赖central,指定下载地址-->

                  <repository>

                       <id>central</id>

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

                       <!—releases正式版本 -->

                       <releases><enabled>true</enabled></releases>

                       <!—snapshots先行版本 -->

                       <snapshots><enabled>true</enabled></snapshots>

                  </repository>

            </repositories>

            <pluginRepositories>

                  <!—插件central,指定下载地址-->

                  <pluginRepository>

                       <id>central</id>

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

                       <releases><enabled>true</enabled></releases>

                       <snapshots><enabled>true</enabled></snapshots>

                  </pluginRepository>

            </pluginRepositories>

       </profile>

 </profiles>

------------------------------------分割线--------------------------------------------

<!—下载地址可以配置多个,这里指定使用哪一个地址-->

<activeProfiles>

          <!--makethe profile active all the time -->

          <activeProfile>nexus</activeProfile>

</activeProfiles>

------------------------------------分割线--------------------------------------------

<!-- 设置发布时的用户名 -->

<servers>

 <server>

  <!--正式版本 -->

  <id> releases </id>

<username>admin</username>

<password>admin123</password>

</server>

<server>

<!—先行版本 -->

<id> snapshots </id>

<username>admin</username>

<password>admin123</password>

 </server>

</servers>

五、  pom.xml

部署构建到Nexus,包含Release和Snapshot

<distributionManagement>

<repository>

<id>releases</id>

  <name>InternalReleases</name>  <url>http://localhost:8000/nexus/content/repositories/releases/</url>

</repository>

<snapshotRepository>

       <id>snapshots</id>

       <name>Internal Snapshots</name>       <url>http://localhost:8000/nexus/content/repositories/snapshots/</url>

</snapshotRepository>

</distributionManagement>

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐只乐之

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值