修改Maven仓库地址

修改Maven仓库地址

%USERPROFILE%\.m2\settings.xml例如:C:\Users\LongShu\.m2\settings.xml 
可以自定义Maven的一些参数, 
复制%M2_HOME%\conf\settings.xml到这个目录修改一下配置。

  1. 本地仓库 
    在settings节点里添加 
<localRepository>D:\Dev_Tool\m2repository</localRepository>

本地仓库地址将从%USERPROFILE%\.m2\变为D:\Dev_Tool\m2repository\

  1. 远程仓库 
    在mirrors节点内添加
<mirror>
    <id>alimaven</id>
    <mirrorOf>central</mirrorOf>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
<mirror>
    <id>jcenter</id>
    <mirrorOf>central</mirrorOf>
    <name>jcenter.bintray.com</name>
    <url>http://jcenter.bintray.com/</url>
</mirror>

<mirror>
    <id>repo1</id>
    <mirrorOf>central</mirrorOf>
    <name>Human Readable Name for this Mirror.</name>
    <url>http://repo1.maven.org/maven2/</url>
</mirror>
<mirror>
    <id>repo2</id>
    <mirrorOf>central</mirrorOf>
    <name>Human Readable Name for this Mirror.</name>
    <url>http://repo2.maven.org/maven2/</url>
</mirror>

将把原来https的仓库变为http的aliyun中央仓库。

  1. 修改项目仓库 
    在项目pom.xml的project节点内添加以下内容即可
<repositories>
    <repository>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    </repository>
    <repository>
        <id>jcenter</id>
        <name>jcenter Repository</name>
        <url>http://jcenter.bintray.com/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

 原文地址:https://blog.csdn.net/u014335219/article/details/52781014

猜你喜欢

转载自blog.csdn.net/LLnobug/article/details/81563073
今日推荐