zoukankan      html  css  js  c++  java
  • 项目更改版本号之后打包失败 resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced

    在修改项目的版本号之后,如pom.xml中<version>1.2.0-SNAPSHOT</version>替换为<version>1.0.0-RELEASE</version>后,执行打包报错如下:

     ·················resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]

    项目jar包是放在nexus上的,这是由于私服的更新策略导致的,nexus上的依赖库在更新库版本号打包时并没有更新,导致项目打包找不到依赖。

    解决方法:

    方法一: 修改nexus的依赖库更新策略,添加 <updatePolicy>always</updatePolicy>

    <profile>
        <id>zang-nexus</id>
        <repositories>
            <repository>
                <id>zang-nexus</id>
                <url>http://10.253.40.2XX:6XXX/nexus/content/groups/public</url>
                <releases>
                    <enabled>true</enabled>
              <updatePolicy>always</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
              <updatePolicy>always</updatePolicy>
                </snapshots>
            </repository>
        </repositories>
    
        <pluginRepositories>
            <pluginRepository>
                <id>zang-nexus</id>
                <url>http://10.253.40.2XX:6XXX/nexus/content/groups/public</url>
                <releases>
                    <enabled>true</enabled>
              <updatePolicy>always</updatePolicy>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
              <updatePolicy>always</updatePolicy>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>
    </profile>

    方法二:删除未下载成功的文件,重新编译

    maven默认会使用本地缓存的库来编译工程,对于上次下载失败的库,maven会在Repository/<group>/<artifact>/<version>/目录下创建xxx.lastUpdated文件,一旦这个文件存在,那么在直到下一次nexus更新之前都不会更新这个依赖库,所以可以根据报错信息,删除Repository/<group>/<artifact>/<version>/目录下的*.lastUpdated文件,然后再次运行mvn compile编译工程。

  • 相关阅读:
    题解 P3960 【列队】
    题解 P3825 【[NOI2017]游戏】
    题解 P3385 【【模板】负环】
    luoguP1555 尴尬的数字(暴力+map)
    luogu P1775 古代人的难题_NOI导刊2010提高(02)(斐波纳契+数学)
    luogu P1405 苦恼的小明(欧拉定理)
    luogu P2117 小Z的矩阵(结论题)
    BZOJ2870 最长道路tree(并查集+LCA)
    BZOJ 4668 冷战(按秩合并并查集+LCA)
    BZOJ 3376 [Usaco2004 Open]Cube Stacking 方块游戏(带权并查集)
  • 原文地址:https://www.cnblogs.com/zjfjava/p/10421300.html
Copyright © 2011-2022 走看看