zoukankan      html  css  js  c++  java
  • maven setting 配置

    <?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:maven
    epository</localRepository>
      <servers>
           <!-- 1、这里要配置配置上传用户及仓库信息 -->
            <server>
              <id>nexus</id>
              <username>admin</username>
              <password>xxxx</password>
            </server>
        </servers>
        
        <!-- 2、添加maven仓库镜像 -->  
        <mirrors>
            <mirror>
              <id>central-proxy</id>
              <mirrorOf>central</mirrorOf>
              <url>https://xxxx</url>
            </mirror> 
        </mirrors>
        
        <!-- 3、这种方式配置后所有本地使用该配置的maven项目的pom文件都无需配置私服下载相关配置。 -->
        <profiles>
            <profile>
                 <id>mycof</id>
                 <repositories>
                    <repository>
                        <id>nexus</id>
                        <name>my's nexus</name>   
                        <releases>
                            <enabled>true</enabled>
                        </releases>
                        <snapshots>
                            <enabled>true</enabled>
                        </snapshots>
                        <url>http://xxx/groups/public</url>
                    </repository>
                 </repositories> 
                 <pluginRepositories>
                <!--插件库地址-->
               <pluginRepository>
                  <id>nexus</id>
                    <url>http://xxxx/groups/public</url>
                  <releases>
                    <enabled>true</enabled>
                  </releases>
                  <snapshots>
                    <enabled>true</enabled>
                   </snapshots>
                </pluginRepository>
              </pluginRepositories>
            </profile>
    
        </profiles>
           <!-/4、激活profile-->
                <activeProfiles>
                  <activeProfile>mycof</activeProfile>
                </activeProfiles>
    </settings>

    当构建一个Maven项目时,首先检查pom.xml文件以确定依赖包的下载位置,执行顺序如下:

    1、从本地资源库中查找并获得依赖包,如果没有,执行第2步。

    2、如果在pom.xml中定义了自定义的远程仓库,那么也会在这里的仓库中进行查找并获得依赖包,如果没有,执行第3步。

    3、从Maven默认中央仓库中查找并获得依赖包(https://repo1.maven.org/maven2/),如果都没有找到,那么Maven就会抛出异常。

    默认中央仓库的地址:

    1、http://repo1.maven.org/maven2/

    默认的中央仓库id为【central】, setting中<mirrorOf>central</mirrorOf>表示不再从默认中央仓库中获取jar,一般为公司私服地址。

    2、profiles 设置表示:设置一个指定的存储库地址。下载顺序为: 本地库->profiles地址->中央仓库【有mirrorOf则从mirror地址下载,不会再查询默认的中央仓库】

    配置server:

    是向私服上传jar时使用,id 一 一对应,项目中需要在pom.xml中配置如下

        <distributionManagement>
            <repository>
                <id>nexus</id>
                <name>releases</name>
                <url>http://xxx/content/repositories/releases</url>
            </repository>
    
            <snapshotRepository>
                <id>nexus</id>
                <name>snapshots</name>
                <url>http://xxx/content/repositories/snapshots</url>
            </snapshotRepository>
        </distributionManagement>
  • 相关阅读:
    紧急情况下测试周期被压缩该如何测试?
    测试人员提高业务掌握度的方案
    Android客户端性能测试(一):使用APT测试Android应用性能
    转载:员工价值——如何体现自己价值,如何被自己的领导认可
    如何提高测试用例复用性和完善测试用例
    如何理解栈(栈的实现方式)
    Android 自动化测试—robotium(七) 使用Junit_report测试报告
    Android 自动化测试—robotium(八) 拖拽
    解决ADT升级报错
    敏捷测试的关键理念
  • 原文地址:https://www.cnblogs.com/bestzhang/p/13627951.html
Copyright © 2011-2022 走看看