轉載自:
https://www.jb51.net/article/189796.htm
在上一篇文章中完成了 《Maven鏡像地址大全 》,后來又花了時間又去收集並整理了關於 maven 遠程倉庫地址,並整理於此,關於 Maven 遠程倉庫地址的配置方式有兩種,
第一種:直接在項目的 pom.xml 文件中進行修改(不推薦,尤其是在多人協助的開發過程中非常的費事費力);
第二種:將 Maven 的遠程倉庫統一的配置到 Maven 的 Settings.xml 的配置文件中;
Maven 中央倉庫地址大全
1、阿里中央倉庫(首推1)
|
1
2
3
4
5
|
<
repository
>
<
id
>alimaven</
id
>
<
name
>aliyun maven</
name
>
</
repository
>
|
2、camunda.com 中央倉庫(首推2)
|
1
2
3
4
5
|
<
repository
>
<
id
>activiti-repos2</
id
>
<
name
>Activiti Repository 2</
name
>
</
repository
>
|
3、spring.io 中央倉庫
|
1
2
3
4
5
|
<
repository
>
<
id
>springsource-repos</
id
>
<
name
>SpringSource Repository</
name
>
</
repository
>
|
4、maven.apache.org 中央倉庫
|
1
2
3
4
5
|
<
repository
>
<
id
>central-repos</
id
>
<
name
>Central Repository</
name
>
</
repository
>
|
5、maven.org 中央倉庫
|
1
2
3
4
5
|
<
repository
>
<
id
>central-repos1</
id
>
<
name
>Central Repository 2</
name
>
</
repository
>
|
6、alfresco.com 中央倉庫(首推3)
|
1
2
3
4
5
|
<
repository
>
<
id
>activiti-repos</
id
>
<
name
>Activiti Repository</
name
>
</
repository
>
|
7、oschina 中央倉庫(需要x牆喲)
|
1
2
3
4
5
|
<
repository
>
<
id
>oschina-repos</
id
>
<
name
>Oschina Releases</
name
>
</
repository
>
|
8、oschina thinkgem 中央倉庫(需要x牆喲)
|
1
2
3
4
5
|
<
repository
>
<
id
>thinkgem-repos</
id
>
<
name
>ThinkGem Repository</
name
>
</
repository
>
|
9、java.net 中央倉庫(需要x牆喲)
|
1
2
3
4
5
|
<
repository
>
<
id
>java-repos</
id
>
<
name
>Java Repository</
name
>
</
repository
>
|
10、github.com 中央倉庫(需要x牆喲)
|
1
2
3
4
5
|
<
repository
>
<
id
>thinkgem-repos2</
id
>
<
name
>ThinkGem Repository 2</
name
>
</
repository
>
|
Maven 中央倉庫配置示例
這里使用 Dubbo官方的中央倉庫為示例,在 settings.xml 的 profiles 節點中添加如下內容:
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<
profile
>
<
id
>jdk‐1.8</
id
>
<
activation
>
<
activeByDefault
>true</
activeByDefault
>
<
jdk
>1.8</
jdk
>
</
activation
>
<
properties
>
<
maven.compiler.source
>1.8</
maven.compiler.source
>
<
maven.compiler.target
>1.8</
maven.compiler.target
>
<
maven.compiler.compilerVersion
>1.8</
maven.compiler.compilerVersion
>
</
properties
>
<!-- dubbo 官方的解決方案 -->
<
repositories
>
<
repository
>
<
id
>sonatype-nexus-snapshots</
id
>
<
releases
>
<
enabled
>false</
enabled
>
</
releases
>
<
snapshots
>
<
enabled
>true</
enabled
>
</
snapshots
>
</
repository
>
</
repositories
>
</
profile
>
|
如下圖:

注意:這兒的jdk-1.8表示,在開發環境中使用jdk-1.8時,則激活該環境;
