“Maven:settings.xml示例”的版本间差异

来自Wikioe
跳到导航 跳到搜索
无编辑摘要
 
第2行: 第2行:


== 关于 ==
== 关于 ==
{| class="wikitable"
! 仓库 !! url
|-
| 阿里云 || http://maven.aliyun.com/nexus/content/groups/public/
|-
| apache || http://repo.maven.apache.org/maven2
|-
| camunda || https://app.camunda.com/nexus/content/groups/public
|-
| spring.io || http://repo.spring.io/release/
|-
| ibiblio || http://www.ibiblio.org/maven2
|-
| jboss || http://repository.jboss.com/maven2/
|}
=== 关于:阿里云 Maven 仓库 ===
  阿里云 Maven 仓库:
  阿里云 Maven 仓库:
   
   

2022年5月10日 (二) 16:21的最新版本


关于

仓库 url
阿里云 http://maven.aliyun.com/nexus/content/groups/public/
apache http://repo.maven.apache.org/maven2
camunda https://app.camunda.com/nexus/content/groups/public
spring.io http://repo.spring.io/release/
ibiblio http://www.ibiblio.org/maven2
jboss http://repository.jboss.com/maven2/

关于:阿里云 Maven 仓库

阿里云 Maven 仓库:

1、目前还未支持生成和下载 maven indexer 文件

2、不再支持 http 下载,只支持 https。

使用指南:https://developer.aliyun.com/mvn/guide

示例一:使用 central、alimaven

central 仓库地址:https://repo.maven.apache.org/maven2/
阿里云 Maven 仓库地址:https://maven.aliyun.com/repository/public

配置

settings.xml(展开/隐藏)

如上,配置了:

  1. 本地仓库路径为:“D:\Repository”;
  2. 一个 profile(dev),包含两个 repository(aliyun、central)、两个 pluginRepository(aliyun、central);
  3. 两个 mirror:(repo1、repo2),用作 repository(central)的镜像;
    • repo1、repo2 镜像可以更新索引,但不稳定且速度慢;
  4. 在 activeProfiles 中启用了 profile(dev);

效果

在 Eclipse 中:

Eclipse中的Maven仓库.png

在 IDEA 中:

Idea中的Maven仓库.png

示例二:使用 nexus2/3

本地 nexus2:http://localhost:8090/nexus/content/groups/public/
本地 nexus3:http://localhost:8091/repository/maven-public/

以下使用了本地安装的 nexus3(如使用 nexus2,替换地址即可)

配置

settings.xml(展开/隐藏)

如上,配置了:

  1. 本地仓库路径为:“D:\Repository”;
  2. 三个 server:
    1. Server(<id>nexus3</id>):登录 mirror 的用户名密码;
      • 其中 <id> 须对应:<mirror><id>
    2. Server(<id>releases</id>):项目上传 releases 版本的用户名密码;
      • 其中 <id> 须对应:项目“pom.xml”<distributionManagement><repository><id>
    3. Server(<id>snapshots</id>):项目上传 snapshots 版本的用户名密码;
      • 其中 <id> 须对应:项目“pom.xml”<distributionManagement> <snapshotRepository><id>
        项目“pom.xml”示例:
        	...
        	
        	<distributionManagement>
        		<repository>
        			<id>releases</id>
        			<name>maven-releases</name>
        			<url>http://localhost:8091/repository/maven-releases/</url>
        		</repository>
        
        		<snapshotRepository>
        			<id>snapshots</id>
        			<name>maven-snapshots</name>
        			<url>http://localhost:8091/repository/maven-snapshots/</url>
        		</snapshotRepository>
        	</distributionManagement>
        
        	...
        
  3. 一个 profile(dev):包含一个 repository(本地 nexus3)、一个 pluginRepository(本地 nexus3);
  4. 一个 mirror:用作所有仓库的镜像(本地 nexus3);
  5. 在 activeProfiles 中启用了 profile(dev);

【以上,仓库、镜像,都用“本地 nexus3”,所以重复了,可省略其一】

效果

在 Eclipse 中:

Eclipse中的Maven仓库 2.png

在 IDEA 中:

Idea中的Maven仓库 2.png

附:备份“${user.home}/.m2/settings.xml”:(使用 alimaven)

settings.xml(展开/隐藏)

如上,仅配置了:一个 mirror(alimaven)用作 repository(central)的镜像;

  • 如果不配置 Repository,则Maven 仍然有一个默认仓库“central”(存在于源码)