欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

maven 配置多個(gè)倉庫的方法

 更新時(shí)間:2020年08月28日 11:08:32   作者:itprobie-菜鳥程序員  
這篇文章主要介紹了maven 配置多個(gè)倉庫的方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

1>方法一

之前在配置 Maven 的 settings.xml 時(shí),都會(huì)設(shè)置 mirror 節(jié)點(diǎn),例如:

<mirrors>
  <mirror>
    <id>alimaven</id>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>
  </mirror>
</mirrors>

然后第一想法就是在 mirrors 節(jié)點(diǎn)下多增加幾個(gè) mirror,然而并不可以。正確的操作是在 profiles 節(jié)點(diǎn)下配置多個(gè) profile,而且配置之后要激活。例如:

配置profiles

<profiles>
  <profile>
   <id>boundlessgeo</id> 
   <repositories>
    <repository>
     <id>boundlessgeo</id> 
     <url>https://repo.boundlessgeo.com/main/</url> 
     <releases>
      <enabled>true</enabled>
     </releases> 
     <snapshots>
      <enabled>true</enabled> 
      <updatePolicy>always</updatePolicy>
     </snapshots>
    </repository>
   </repositories>
  </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> 
      <updatePolicy>always</updatePolicy>
     </snapshots>
    </repository>
   </repositories>
  </profile> 
  <profile>
   <id>maven-central</id> 
   <repositories>
    <repository>
     <id>maven-central</id> 
     <url>http://central.maven.org/maven2/</url> 
     <releases>
      <enabled>true</enabled>
     </releases> 
     <snapshots>
      <enabled>true</enabled> 
      <updatePolicy>always</updatePolicy>
     </snapshots>
    </repository>
   </repositories>
  </profile>
<profiles>

通過配置 activeProfiles 子節(jié)點(diǎn)激活

<activeProfiles>
  <activeProfile>boundlessgeo</activeProfile>
  <activeProfile>aliyun</activeProfile>
  <activeProfile>maven-central</activeProfile>
</activeProfiles>

如果在IDE里,記得要更新生效,然后就可以了。

2> 方法二

在項(xiàng)目中添加多個(gè)倉庫,是通過修改項(xiàng)目中的pom文件實(shí)現(xiàn)的。
思路:在項(xiàng)目中pom文件的repositories節(jié)點(diǎn)(如果沒有手動(dòng)添加)下添加多個(gè)repository節(jié)點(diǎn),每個(gè)repository節(jié)點(diǎn)是一個(gè)倉庫。 

<repositories>
    <repository>
      <!-- id必須唯一 -->
      <id>jboss-repository</id>
      <name>jboss repository</name>
      <url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
    </repository>
    <repository>
      <id>aliyun-repository</id>
      <name>aliyun repository</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </repository>
 
 
    <repository>
     <id>奇葩倉庫</id>
     <url>https://奇葩倉庫/public/</url>
    </repository>
 
  </repositories>

到此這篇關(guān)于maven 配置多個(gè)倉庫的方法的文章就介紹到這了,更多相關(guān)maven 多個(gè)倉庫配置內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java面試題沖刺第二十天--算法(1)

    Java面試題沖刺第二十天--算法(1)

    這篇文章主要為大家分享了最有價(jià)值的三道關(guān)于算法的面試題,涵蓋內(nèi)容全面,包括數(shù)據(jù)結(jié)構(gòu)和算法相關(guān)的題目、經(jīng)典面試編程題等,感興趣的小伙伴們可以參考一下
    2021-08-08
  • 詳解Java多線程處理List數(shù)據(jù)

    詳解Java多線程處理List數(shù)據(jù)

    這篇文章主要介紹了Java多線程處理List數(shù)據(jù),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-03-03
  • IDEA Debug模式下改變各類型變量值的方法

    IDEA Debug模式下改變各類型變量值的方法

    這篇文章主要介紹了IDEA Debug模式下改變各類型變量值的方法,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2018-04-04
  • Java中Comparable與Comparator的區(qū)別解析

    Java中Comparable與Comparator的區(qū)別解析

    這篇文章主要介紹了Java中Comparable與Comparator的區(qū)別解析,實(shí)現(xiàn)Comparable接口,重寫compareTo方法,一般在實(shí)體類定義的時(shí)候就可以選擇實(shí)現(xiàn)該接口,提供一個(gè)默認(rèn)的排序方式,供Arrays.sort和Collections.sort使用,需要的朋友可以參考下
    2024-01-01
  • Java full gc觸發(fā)情況實(shí)例解析

    Java full gc觸發(fā)情況實(shí)例解析

    這篇文章主要介紹了Java full gc觸發(fā)情況實(shí)例解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-04-04
  • 反射機(jī)制:getDeclaredField和getField的區(qū)別說明

    反射機(jī)制:getDeclaredField和getField的區(qū)別說明

    這篇文章主要介紹了反射機(jī)制:getDeclaredField和getField的區(qū)別說明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-06-06
  • Spring中的ClassPathXmlApplicationContext源碼詳解

    Spring中的ClassPathXmlApplicationContext源碼詳解

    這篇文章主要介紹了Spring中的ClassPathXmlApplicationContext源碼詳解,ApplicationContext的主要實(shí)現(xiàn)類是ClassPathXmlApplicationContext和FileSystemXmlApplicationContext,前者默認(rèn)從類路徑加載配置文件,后者默認(rèn)從文件系統(tǒng)中裝載配置文件,需要的朋友可以參考下
    2023-12-12
  • 獲取Java的MyBatis框架項(xiàng)目中的SqlSession的方法

    獲取Java的MyBatis框架項(xiàng)目中的SqlSession的方法

    SqlSession中包括已經(jīng)映射好的SQL語句,這樣對(duì)象實(shí)例就可以直接拿過來用了,那么這里就來講解獲取Java的MyBatis框架項(xiàng)目中的SqlSession的方法
    2016-06-06
  • linux下用renameTo方法修改java web項(xiàng)目中文件夾名稱的實(shí)例

    linux下用renameTo方法修改java web項(xiàng)目中文件夾名稱的實(shí)例

    下面小編就為大家?guī)硪黄猯inux下用renameTo方法修改java web項(xiàng)目中文件夾名稱的實(shí)例。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-06-06
  • mybatis攔截器注冊(cè)初始化編寫示例及如何生效詳解

    mybatis攔截器注冊(cè)初始化編寫示例及如何生效詳解

    這篇文章主要為大家介紹了mybatis攔截器注冊(cè)初始化編寫示例及如何生效詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-08-08

最新評(píng)論