maven 配置多個倉庫的方法
1>方法一
之前在配置 Maven 的 settings.xml 時,都會設(shè)置 mirror 節(jié)點,例如:
<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é)點下多增加幾個 mirror,然而并不可以。正確的操作是在 profiles 節(jié)點下配置多個 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é)點激活
<activeProfiles> <activeProfile>boundlessgeo</activeProfile> <activeProfile>aliyun</activeProfile> <activeProfile>maven-central</activeProfile> </activeProfiles>
如果在IDE里,記得要更新生效,然后就可以了。
2> 方法二
在項目中添加多個倉庫,是通過修改項目中的pom文件實現(xiàn)的。
思路:在項目中pom文件的repositories節(jié)點(如果沒有手動添加)下添加多個repository節(jié)點,每個repository節(jié)點是一個倉庫。
<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 配置多個倉庫的方法的文章就介紹到這了,更多相關(guān)maven 多個倉庫配置內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Java中的自動拆裝箱、基本類型的轉(zhuǎn)換、包裝類的緩存詳解
文章詳細(xì)介紹了Java中數(shù)據(jù)類型的拆裝箱、自動拆箱和裝箱,以及包裝類的緩存機(jī)制,包括基本數(shù)據(jù)類型的容量大小、轉(zhuǎn)換規(guī)則和自動類型轉(zhuǎn)換等2024-12-12SpringBoot實現(xiàn)Server-Sent Events(SSE)的使用完整指南
使用SpringBoot實現(xiàn)Server-Sent Events(SSE)可以有效處理實時數(shù)據(jù)推送需求,具有單向通信、輕量級和高實時性等優(yōu)勢,本文詳細(xì)介紹了在SpringBoot中創(chuàng)建SSE端點的步驟,并通過代碼示例展示了客戶端如何接收數(shù)據(jù),適用于實時通知、數(shù)據(jù)展示和在線聊天等場景2024-09-09SpringBoot使用thymeleaf實現(xiàn)一個前端表格方法詳解
Thymeleaf是一個現(xiàn)代的服務(wù)器端 Java 模板引擎,適用于 Web 和獨立環(huán)境。Thymeleaf 的主要目標(biāo)是為您的開發(fā)工作流程帶來優(yōu)雅的自然模板,本文就來用它實現(xiàn)一個前端表格,感興趣的可以了解一下2022-10-10關(guān)于mybatis-plus邏輯刪除自動填充更新時間的問題
mybatis-plus是對mybatis的增強(qiáng),mybatis-plus更像是面向?qū)ο缶幊?,?shù)據(jù)庫基本CRUD的操作可以不用手動編寫SQL語句,大大提高了開發(fā)的效率,這篇文章主要介紹了mybatis-plus邏輯刪除自動填充更新時間問題,需要的朋友可以參考下2022-07-07