问题背景

项目生产环境因为各种原因,不允许访问maven仓库,只能将本地下载完成的仓库打包上传到服务器上。maven构建命令如下:

mvn clean package -Pprod -Dmaven.test.skip=true -o

其中-o标识离线模式。同时也需要在maven的setting.xml文件中指定离线模式:

问题现象

报错信息如下:

[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact com.fasterxml.jackson:jackson-bom:pom:2.10.0 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 629, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact io.micrometer:micrometer-bom:pom:1.3.1 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 1027, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact io.netty:netty-bom:pom:4.1.43.Final has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 1034, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact io.projectreactor:reactor-bom:pom:Dysprosium-SR1 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 1046, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact io.rsocket:rsocket-bom:pom:1.0.0-RC5 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 1108, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact org.apache.logging.log4j:log4j-bom:pom:2.12.1 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 1797, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact org.eclipse.jetty:jetty-bom:pom:9.4.22.v20191022 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 2105, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact org.glassfish.jersey:jersey-bom:pom:2.29.1 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 2239, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact org.jetbrains.kotlin:kotlin-bom:pom:1.3.50 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 2581, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact org.jetbrains.kotlinx:kotlinx-coroutines-bom:pom:1.3.2 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 2588, column 19 -> [Help 2]
[ERROR]     Non-resolvable import POM: Cannot access nexus (http://maven.xxxyyy.com/nexus/content/groups/public/) in offline mode and the artifact org.junit:junit-bom:pom:5.5.2 has not been downloaded from it before. @ org.springframework.boot:spring-boot-dependencies:2.2.1.RELEASE, /mvnrepo/org/springframework/boot/spring-boot-dependencies/2.2.1.RELEASE/spring-boot-dependencies-2.2.1.RELEASE.pom, line 2615, column 19 -> [Help 2]

解决方案

在本地仓库根目录下,执行以下命令:

find . -name "_remote.repositories" | xargs rm

该命令会删除所有子目录下_remote.repositories文件。

参考

https://stackoverflow.com/questions/16866978/maven-cant-find-my-local-artifacts/16870552

maven离线(offline)构建时无法找到本地依赖 Non-resolvable import POM: Cannot access nexus相关推荐

  1. maven离线安装easyexcel要把easyexcel内部依赖的jar包一并导入

    以easyexcel2.2.6为例,其内部依赖的jar包包括以下 test注释以上的依赖都需要离线状态下一并导入.此外,还要注意上面的内部依赖是否还有内部依赖,若有也需要一并导入. 在有网状态下的正常 ...

  2. 【问题解决】SpringBoot工程无法找到父依赖 parent-pom Failure to find com.xxx:parent-pom:pom:1.0.0.RELEASE

    总结下碰到的BUG,之前遇到忘记记录下来,导致又进行了重复无用的搜索定位解决BUG操作. 问题: Non-resolvable parent POM for com.alili:base-model: ...

  3. work offline / .repository / maven离线下载依赖

    work offline / .repository / maven离线现在依赖 有时候我们想要使用本地maven仓库的依赖(即使用idea离线导入maven仓库的时候),导入不成功的错误,经过分析, ...

  4. 解决maven构建时警告:The artifact xxx has been relocated to xxx

    最近写的项目在构建时出现警告内容: The artifact mysql:mysql-connector-java:jar:8.0.33 has been relocated to com.mysql ...

  5. maven打包时加入依赖包及加入本地依赖包

    maven打包的时候默认是不加入依赖的jar包的,所以想打出一个独立的可运行jar包的话直接mvn clean install package是不行的.需要略改动下pom文件,加入如下plugin ? ...

  6. 解决Maven离线下载中心仓库连接失败问题

    当有时候我们无法连接到maven的中心仓库时,会报如下错误: [WARNING] Could not transfer metadata.... ...Connect to 172.16.0.XX:8 ...

  7. maven 项目管理和构建工具

    mvn 1. maven 是什么 2. maven能解决什么问题 3. maven 需要配置和下载 4. 使用eclipse创建maven项目 5. xml依赖配置 作用范围 6. maven的常用命 ...

  8. GitChat · 软件工程 | 一小时教你学会 Maven 项目的构建与管理

    GitChat 作者:梁鹏举 原文: 一小时教你学会 Maven 项目的构建与管理 关注公众号:GitChat 技术杂谈,一本正经的讲技术 Maven翻译成中文是"专家.内行".M ...

  9. maven离线模式及设置

    maven离线模式及设置 maven离线模式使用场景? 遇到的问题: 最近遇到个项目支持,他在打jar包的时候,总是去网上下载 maven依赖,不去找我本地仓库的,就比较头大,原因不明 现在需求:就是 ...

最新文章

  1. SPSS数据记录的选择(Select Cases)
  2. 数据库常用语句(日常填充)
  3. c#中mysql远程连接方法及实例
  4. 你不得不了解的10款服务器监控工具
  5. vc++调用jni_通过JNI使用C ++尖叫快速进行Lucene搜索
  6. 80×60长40米的地笼_石家庄Q345矩形方管 220*80*8方管 华东地区
  7. Spark之RDD实战2
  8. 对学习linux一周的总结
  9. WebWork配置文件详解
  10. ctfmon.exe
  11. openresty性能调优
  12. 【Win10】【亲手解决】华硕笔记本重装系统遇到的各种问题【包括重启会自动修复】
  13. 计算机用户名显示TEMP,win10只要打开ie桌面出现temp文件夹如何解决
  14. Folx Pro5最新版适用Mac电脑网络BT下载器
  15. ultraISO如何把ISO镜像文件加载虚拟光驱
  16. linux系统下(x86_64)安装jdk 1.6(jdk-6u45-linux-x64.bin)
  17. CRC16算法是什么
  18. 算法题 子数组之和为零
  19. c# datatable数据合并方法
  20. 基于正点原子STM32F1精英版秒表(库函数版)

热门文章

  1. 矩阵论(一):广义逆矩阵(上)
  2. SaltStack之return与job管理
  3. chrome打开网页很慢,别的浏览器打开相同的网页很快
  4. 【无标题】打印水仙花(pyth)
  5. 【资源帖】漏洞平台(国内外)+企业SRC整理-持续更新
  6. python比对excel表数据中的差异_Excel表格中数据比对和查找的几种技巧
  7. 干货|以产品要素设计解读线上小微信贷
  8. 技术人如何自我成长?
  9. Python:str()函数
  10. STM32 利用cubemx配置正点原子4.3寸TFT-LCD 驱动芯片NT35510