1. 程式人生 > >IDEA配置maven中央庫

IDEA配置maven中央庫

分兩步:
STEP 1:配置maven;
STEP 2:配置IDEA。區分預設配置和專案級配置。

STEP 1:maven中央庫配置

 

國內常用的maven庫主要是阿里雲maven庫、華為雲maven。

其中阿里雲maven庫配置如下:

配置檔案路徑為conf/settings.xml

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    
     
--> <!-- 阿里雲倉庫 --> <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </
mirror> <!-- 中央倉庫1 --> <mirror> <id>repo1</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo1.maven.org/maven2/</url> </
mirror> <!-- 中央倉庫2 --> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> <mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors>

 

STEP 2:IDEA配置

開啟IDEA,按下Ctrl+Alt+S,進入配置選項介面