Maven构建项目失败 Non-resolvable import POM
- Non-resolvable import POM: XXX:pom:4.2.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt.
- 项目结构
- 定位错误
- 解决问题
- 打包碰到另外的问题
- Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7.5:repackage (repackage) on project gxc-common
Non-resolvable import POM: XXX:pom:4.2.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt.
Non-resolvable import POM: com.squareup.okhttp3:okhttp-bom:pom:4.2.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt.
项目结构
主模块+子模块结构
个人版本配置
Maven打包clean时报错截图
[ERROR] The project com.hue:gxc:0.0.1-SNAPSHOT (D:\Demo\MyOwnProject\gxc\pom.xml) has 1 error
[ERROR] Non-resolvable import POM: com.squareup.okhttp3:okhttp-bom:pom:4.2.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced @ org.springframework.boot:spring-boot-dependencies:2.7.5, C:\Users\zzzy0.m2\repository\org\springframework\boot\spring-boot-dependencies\2.7.5\spring-boot-dependencies-2.7.5.pom, line 2643, column 19 -> [Help 2]
[ERROR]
定位错误
Non-resolvable import POM: com.squareup.okhttp3:okhttp-bom:pom:4.2.0 was not found in https://repo.maven.apache.org/maven2 during a previous attempt.
翻译一下大致意思是引用的okhttp这个包的4.2.0版本不在我们maven仓库里面了
点击链接查看 https://repo.maven.apache.org/maven2 找到对应包
发现确实没有这个版本了
解决问题
在个人配置properties修改版本号, 随便选一个存在的版本即可, 本人选用4.4.0
ok, 问题解决
打包碰到另外的问题
Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7.5:repackage (repackage) on project gxc-common
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.7.5:repackage (repackage) on project gxc-common: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.7.5:repackage failed: Unable to find main class -> [Help 1]
此处翻译为不能执行org.springframework.boot:spring-boot-maven-plugin:2.7.5 , 不能执行打包插件
项目暂时什么代码都没有写, 只是搭建一个框架出来, 但是我还是写了build配置, 这部分使用到了plugin, 注释掉之后就没问题了
环境问题总是让人摸不着头脑…