maven离线(offline)构建时无法找到本地依赖 Non-resolvable import POM: Cannot access nexus
生活随笔
收集整理的這篇文章主要介紹了
maven离线(offline)构建时无法找到本地依赖 Non-resolvable import POM: Cannot access nexus
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
問(wèn)題背景
項(xiàng)目生產(chǎn)環(huán)境因?yàn)楦鞣N原因,不允許訪問(wèn)maven倉(cāng)庫(kù),只能將本地下載完成的倉(cāng)庫(kù)打包上傳到服務(wù)器上。maven構(gòu)建命令如下:
mvn clean package -Pprod -Dmaven.test.skip=true -o其中-o標(biāo)識(shí)離線模式。同時(shí)也需要在maven的setting.xml文件中指定離線模式:
問(wèn)題現(xiàn)象
報(bào)錯(cuò)信息如下:
[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]解決方案
在本地倉(cāng)庫(kù)根目錄下,執(zhí)行以下命令:
find . -name "_remote.repositories" | xargs rm該命令會(huì)刪除所有子目錄下_remote.repositories文件。
參考
https://stackoverflow.com/questions/16866978/maven-cant-find-my-local-artifacts/16870552
總結(jié)
以上是生活随笔為你收集整理的maven离线(offline)构建时无法找到本地依赖 Non-resolvable import POM: Cannot access nexus的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 【Android】基于Airtest实现
- 下一篇: 华为什么出鸿蒙系统,华为已官宣鸿蒙,中兴