Maven設置snapshot無法在遠程倉庫下載的問題解決


檢查步驟如下:

1、檢查nexus是否納入public版本中:

2、配置中是否啟用snapshots功能。以下方法兩種設置都可以,任選一個即可。

一種是在項目pom.xml使用:

<repositories>
    <repository>
        <id>test-nexus</id>
        <name>test</name>
        <url>http://192.168.1.253/nexus/content/groups/public/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

另外一種是直接在maven的settings.xml中體現:

<profiles>
    <profile>
        <id>nexus</id>
        <repositories>
            <repository>
                <id>central</id>
                <name>Nexus</name>
                <url>http://192.168.1.253/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <name>Nexus</name>
                <url>http://192.168.1.253/nexus/content/groups/public/</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>
</profiles>
<activeProfiles>
  <activeProfile>nexus</activeProfile>
</activeProfiles>  

activeProfile一定要加,不然配置不生效。結構很簡單,以profile的形式引入,pluginRepository節點可以不用引入,但是snapshots enabled必須設置為true。

可以查看配置是否生效:

mvn help:effective-pom
或者
mvn compile -U

 

參考:

https://www.cnblogs.com/2005wind/p/4899983.html(以上內容轉自此篇文章)

http://blog.sina.com.cn/s/blog_70ae1d7b0102wo9h.html

http://blog.csdn.net/xiaojianpitt/article/details/7818161

http://maven.apache.org/settings.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM