zoukankan      html  css  js  c++  java
  • Maven本地上有包还去网上找包

    Maven本地上有包还去网上找包?

    场景

    • 内网环境
    • 拿到一个本地库之后,进行编译,提示少包.
    • 从别的地方获取到包之后,放到本地库内后, 重新进行编译, 却还是少包
    • 在settings内设置了offline为true也没有用, 依旧找不到包

    日志:

    [ERROR] Plugin org.springframework.boot:spring-boot-maven-plugin:1.5.6.RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.springframework.boot:spring-boot-maven-plugin:jar:1.5.6.RELEASE: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:1.5.6.RELEASE from/to central (http://repo1.maven.org/maven2): repo1.maven.org: Name or service not known: Unknown host repo1.maven.org: Name or service not known -> [Help 1]
    

    解决方法

    删除本地库所有remote.repositories与lastUpdated

    # cd 到本地库后, 
    find -name "*remote.repositories" -or -name "*.lastUpdated" -type f |xargs rm -rf 
    

    问题原因

    在Maven读取本地库依赖的时候,会有一个验证Verifying availability过程.
    而下载包的过程中

    • 如下载成功, 会生成_remote.repositories文件, 记录该包来源.
    • 如下载失败, 会生成.lastUpdated文件, 记录下载失败的链接库地址.

    Verifying availability验证过程中如果发现依赖所在的文件夹内有以上文件, 则会进行对比, 如果对比结果有异则包验证失败.

  • 相关阅读:
    3.1.3、控制结构
    3.1.2、变量
    3.1.1、渲染模板
    3.1、Jinja2模板引擎
    第3章 模板
    2.6、Flask扩展
    2.5.4、响应
    2.5.3、请求钩子
    2.5.2、请求调度
    2.5.1、程序和请求上下文
  • 原文地址:https://www.cnblogs.com/jrri/p/15480408.html
Copyright © 2011-2022 走看看