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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值