Maven settings.xml配置(含新阿里云仓库地址)
记录一下配置,以免今后重装的时候需要搜索大量的资料。
1. jar包地址自定义:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- 自定义本地jar包保存地址 -->
<localRepository>D:\Develop\apache-maven-3.6.3\repo</localRepository>
2. jar包镜像地址配置
<mirrors>
<!-- 阿里云旧地址 -->
<mirror>
<!-- id仅是此settings.xml文件中配置mirror的唯一标识 -->
<id>nexus-aliyun</id>
<!-- 指定仓库的类型范围 -->
<mirrorOf>central</mirrorOf>
<!-- 给这个mirror起个名称,类似于说明 -->
<name>nexus-aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
<!-- 不配置中央仓库的地址也完全可以,因为maven在配置的镜像中搜索不到jar包后,默认会再去中央仓库查找jar包 -->
<!-- 中央仓库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>
</mirrors>
3. 配置JDK版本
<profiles>
<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>
</profile>
</profiles>
4. 阿里云新镜像地址配置
新阿里云镜像地址
提示的maven配置指南并不明确,在此明确阿里云新镜像地址的配置mirror,希望对大家有所帮助:
<!-- 阿里云新地址之public,central仓和jcenter仓的聚合仓 -->
<mirror>
<id>aliyun-public</id>
<mirrorOf>*</mirrorOf>
<name>aliyun public</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
<!-- 阿里云新地址之central -->
<mirror>
<id>aliyun-central</id>
<mirrorOf>*</mirrorOf>
<name>aliyun central</name>
<url>https://maven.aliyun.com/repository/central</url>
</mirror>
如能帮助到大家甚好,如转载,须注明出处,并附原文链接!
(本文完!)
还没有评论,来说两句吧...