美文网首页
maven 私有库配置文件 setting.xml

maven 私有库配置文件 setting.xml

作者: 揪个太阳 | 来源:发表于2018-10-08 19:02 被阅读86次
    <?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
       | The path to the local repository maven will use to store artifacts.
       |
       | Default: ${user.home}/.m2/repository
      <localRepository>/path/to/local/repo</localRepository>
      -->
      <!--设置本地仓库-->
    <localRepository>D:\tools\apache-maven-3.3.3\repository</localRepository>
    
      <!-- interactiveMode
       | This will determine whether maven prompts you when it needs input. If set to false,
       | maven will use a sensible default value, perhaps based on some other setting, for
       | the parameter in question.
       |
       | Default: true
      <interactiveMode>true</interactiveMode>
      -->
    
      <!-- offline
       | Determines whether maven should attempt to connect to the network when executing a build.
       | This will have an effect on artifact downloads, artifact deployment, and others.
       |
       | Default: false
      <offline>false</offline>
      -->
    
      <!-- pluginGroups
       | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
       | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
       | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
       |-->
      <pluginGroups>
        <!-- pluginGroup
         | Specifies a further group identifier to use for plugin lookup.
        <pluginGroup>com.your.plugins</pluginGroup>
        -->
        <pluginGroup>org.mortbay.jetty</pluginGroup>
      </pluginGroups>
    
      <!-- proxies
       | This is a list of proxies which can be used on this machine to connect to the network.
       | Unless otherwise specified (by system property or command-line switch), the first proxy
       | specification in this list marked as active will be used.
       |-->
      <proxies>
        <!-- proxy
         | Specification for one proxy, to be used in connecting to the network.
         |
        <proxy>
          <id>optional</id>
          <active>true</active>
          <protocol>http</protocol>
          <username>proxyuser</username>
          <password>proxypass</password>
          <host>proxy.host.net</host>
          <port>80</port>
          <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
        </proxy>
        -->
      </proxies>
    
      <!-- servers
       | This is a list of authentication profiles, keyed by the server-id used within the system.
       | Authentication profiles can be used whenever maven must make a connection to a remote server.
       |-->
     <servers>  
          <server>  
          <id>nexus-releases</id>  
          <username>builder</username>  
          <password>builder</password>  
        </server>  
        <server>  
          <id>nexus-snapshots</id>  
          <username>builder</username>  
          <password>builder</password>  
        </server>
      </servers>  
    
     <!--设置私库mirror 表示maven所有的请求都由nexus来处理-->
      <mirrors>
        <mirror>
          <!--This sends everything else to /public -->
          <id>nexus</id>
          <mirrorOf>*</mirrorOf> 
          <url>http://127.0.0.1:111/public</url>
        </mirror>
      </mirrors>
    
    
      <profiles> 
        <profile>
          <id>nexus</id>
          <repositories>
            <repository>
              <id>nexus</id>
              <url>http://127.0.0.1:111/public/</url>
              <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
              <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
            </repository>
          </repositories>
         <pluginRepositories>
            <pluginRepository>
              <id>nexus</id>
              <url>http://127.0.0.1:111/public/</url>
              <releases><enabled>true</enabled><updatePolicy>always</updatePolicy></releases>
              <snapshots><enabled>true</enabled><updatePolicy>always</updatePolicy></snapshots>
            </pluginRepository>
          </pluginRepositories>
        </profile>
        
        
        <!--覆盖maven中央仓库设置开启releases和snapshots版本的下载-->
        <profile> 
          <id>central</id> 
          <repositories> 
               <repository> 
                  <id>central</id> 
                  <url>http://central</url> 
                  <releases><enabled>true</enabled></releases> 
                  <snapshots><enabled>true</enabled></snapshots> 
              </repository> 
          </repositories> 
          <pluginRepositories> 
              <pluginRepository> 
                  <id>central</id> 
                  <url>http://central</url> 
                  <releases><enabled>true</enabled></releases> 
                  <snapshots><enabled>true</enabled></snapshots> 
              </pluginRepository> 
          </pluginRepositories> 
        </profile> 
      </profiles>
      <!--激活私库信息的配置--> 
       <activeProfiles>
        <activeProfile>nexus</activeProfile>
        <activeProfile>central</activeProfile> 
       </activeProfiles>
    </settings>
    
    

    相关文章

      网友评论

          本文标题:maven 私有库配置文件 setting.xml

          本文链接:https://www.haomeiwen.com/subject/gmwjaftx.html