Maven

repositories和mirrors的配置

查看配置文件位置

mvn -X
Reading global settings from /users/module/apache-maven-3.5.0/conf/settings.xml
Reading user settings from /Users/user/.m2/settings.xml
Using local repository at /Users/user/.m2/repository
Using mirror alimaven (http://maven.aliyun.com/nexus/content/groups/public) for central (https://repo.maven.apache.org/maven2)

全局配置(settings.xml)

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

单项目配置(pom.xml)

    <repositories>
        <repository>
            <id>central</id>
            <name>aliyun maven</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
            <layout>default</layout>
            <!-- 是否开启发布版构件下载 -->
            <releases>
                <enabled>true</enabled>
            </releases>
            <!-- 是否开启快照版构件下载 -->
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

maven默认的内置仓库的配置位置

<!--
可以从以下文件中找到maven仓库的默认配置如下
apache-maven-3.6.1\lib\maven-model-builder-3.6.1.jar\org\apache\maven\model\pom-4.0.0.xml
-->
<repositories>
  <repository>
   <id>central</id>
   <name>Central Repository</name>
   <url>https://repo.maven.apache.org/maven2</url>
   <layout>default</layout>
   <snapshots>
    <enabled>false</enabled>
   </snapshots>
  </repository>
</repositories>
上一篇:将依赖插件发布到nexus maven私服


下一篇:maven的配置文件settings.xml——配置jar包下载源和maven的项目jdk默认版本