在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java  HTML/ maven如何配置多個(gè)鏡像,多個(gè)不同的項(xiàng)目分別使用其中一個(gè)?

maven如何配置多個(gè)鏡像,多個(gè)不同的項(xiàng)目分別使用其中一個(gè)?

場景

  1. 在公司,做公司的項(xiàng)目A,用的公司的私服.
  2. 在家的時(shí)候,如果還想弄個(gè)其他的項(xiàng)目B玩玩的話,就要去setting.xml中去改鏡像設(shè)置,改成一個(gè)公共的倉庫

maven有沒有提供什么功能可以單獨(dú)為某個(gè)項(xiàng)目設(shè)置遠(yuǎn)程倉庫地址,在公司我做A項(xiàng)目的時(shí)候,他去公司的私服下載jar包.在家里的時(shí)候,沒辦法連到公司的內(nèi)網(wǎng),這時(shí)候用公共的倉庫(比如阿里云等).
不知道要怎么實(shí)現(xiàn).

<mirrors>
    <!-- <mirror>
      <id>releases</id>
      <mirrorOf>central</mirrorOf>
      <name>Team Nexus Repository</name>
      <url>http://192.168.0.222:8081/nexus/content/groups/public</url>
    </mirror> -->
    <mirror>
      <id>aliyun</id>
      <name>aliyun-public</name>
      <mirrorOf>central</mirrorOf>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </mirror>
</mirrors>
回答
編輯回答
冷溫柔

不同的項(xiàng)目,不是可以有不同的maven配置嗎,你把maven的包拷貝一份,整兩個(gè)maven不就好了??

2017年1月5日 03:40
編輯回答
荒城

這個(gè)可以在profiles里面配多個(gè)倉庫吧,在其中一個(gè)倉庫找不到依賴時(shí),會依次從下一個(gè)倉庫里找。要在activeProfiles設(shè)置啟用的倉庫

<profiles>

      <profile>
          <id>sonar</id>
          <properties>
              <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar</sonar.jdbc.url>
              <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
              <sonar.jdbc.username>sonar</sonar.jdbc.username>
              <sonar.jdbc.password>sonar@pw</sonar.jdbc.password>
              <sonar.host.url>http://xx.xx.xx.xx:9000/</sonar.host.url> <!-- Sonar服務(wù)器訪問地址 -->
          </properties>
      </profile>

      <profile>
            <id>aliyun</id>
            <repositories>
                <repository>
                    <id>aliyun</id>
                    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
                    <!-- <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> 
                        </snapshots> -->
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>aliyun</id>
                    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>always</updatePolicy>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
</profiles>
<activeProfiles>
    <activeProfile>sonar</activeProfile>
    <activeProfile>aliyun</activeProfile>
</activeProfiles>
2018年1月29日 10:03