Parent ‘Unknown:Unknown:Unknown‘ has problems 异常的处理

博主在晚上从GitHub拉取项目后,遇到Maven刷新报错,异常包括pom文件引用问题、IDEA报错、依赖无法引入等。尝试清理缓存、更换Maven版本、设置镜像等方法无效。最终发现是由于某个特定版本的jar包导致,通过更改本地仓库地址,重新下载所有依赖解决。然后删除spring-boot-starter-parent相关的本地jar包,恢复正常。

晚上十点在从github拉下来一个项目打开后,maven一刷新,就出了这个诡异的东西!后面就是折磨我了几个小时的过程。

出现这个异常有几个特点:

1、项目的pom文件中使用parent引入,比如:

2、如果直接使用idea的maven刷新按钮报报异常:

Parent 'Unknown:Unknown:Unknown' has problems

3、你运行其他的maven命令会出现:

attribute value must start with quotation or apostrophe not M 然后 后面还有 <html lang="en" data-adblockkey=M... @1:49) 什么什么的鬼东西。翻译过来大概就是pom文件不合法,出现了html的东西。关键是我打开parent节点的父节点,还真是一个html。由于我现在已经解决了就没法截图了。

4、项目的External Libraries里面除了你引入的jdk,一个其他的jar包都没有,你去看看你设置的maven的repository惊奇的发现jar包都完整的下载了下来,但是就是引入不了。

网上所有的方法全部试过,屁用没有。

说一下我自己的解决路径:

我发现一个问题,就是我从打开了那个项目之后,就出现了这个问题,并且我以前自己写的项目都没事的,现在也有了问题。

于是我觉得可能是maven缓存的问题,清理之后还是无法解决。

然后我觉得是不是引入这个项目导致我的maven出现什么bug了,我重新从官网下载了一样的版本和最新的版本,重新指定maven包,无法解决。

maven的setting.xml重新换一份,指定国内镜像,无法解决。

各种尝试无果,我开始怀疑是我引得某个版本的jar包有什么神器的东西导致了maven出了什么问题,我就开始把所有和spring-boot-starter-paren相关的jar从repository中清理了出去,还是无法解决

这个时候我开始怀疑是未知问题导致的idea无法获取maven指定的repository的路径了,我尝试重新指定repository路径,然后开始下载项目依赖的jar包,然后编译OK,解决了!

我这个时候又把repository的路径重新指定会原来的路径,又变回老样子开始报错。但是这时候我又去仓库把之前下载的spring-boot-starter-paren相关的jar包给删除掉,然后重新刷新build,OK了,这样就可以在使用原有的本地仓库地址的情况下解决了问题。

总结一下:我是通过更改本地仓库地址,重新下载所以的依赖解决的。然后又指定原来的本地仓库地址,将spring-boot-starter-parent相关的本地已经下载的jar全部删除就会恢复了。

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called WARNING: sun.misc.Unsafe::staticFieldBase has been called by com.google.inject.internal.aop.HiddenClassDefiner (file:/C:/Maven/apache-maven-3.9.11-bin/apache-maven-3.9.11/lib/guice-5.1.0-classes.jar) WARNING: Please consider reporting this to the maintainers of class com.google.inject.internal.aop.HiddenClassDefiner WARNING: sun.misc.Unsafe::staticFieldBase will be removed in a future release [INFO] Scanning for projects... [INFO] Artifact org.springframework.boot:spring-boot-starter-parent:pom:3.5.4 is present in the local repository, but cached from a remote repository ID that is unavailable in current build context, verifying that is downloadable from [nexus-cargo (http://maven.kgkj.com/repository/public/, default, releases+snapshots), github (https://maven.pkg.github.com/gcs-zhn/ddddocr-for-java, default, releases)] [INFO] Artifact org.springframework.boot:spring-boot-starter-parent:pom:3.5.4 is present in the local repository, but cached from a remote repository ID that is unavailable in current build context, verifying that is downloadable from [nexus-cargo (http://maven.kgkj.com/repository/public/, default, releases+snapshots), github (https://maven.pkg.github.com/gcs-zhn/ddddocr-for-java, default, releases)] Downloading from nexus-cargo: http://maven.kgkj.com/repository/public/org/springframework/boot/spring-boot-starter-parent/3.5.4/spring-boot-starter-parent-3.5.4.pom [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for com.example:test1:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.springframework.boot:spring-boot-starter-parent:pom:3.5.4 (present, but unavailable): Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:3.5.4 from/to nexus-cargo (http://maven.kgkj.com/repository/public/): ��֪�������������� (maven.kgkj.com) and 'parent.relativePath' points at no local POM @ line 5, column 10 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project com.example:test1:0.0.1-SNAPSHOT (C:\Users\14028\IdeaProjects\test\test1\pom.xml) has 1 error [ERROR] Non-resolvable parent POM for com.example:test1:0.0.1-SNAPSHOT: The following artifacts could not be resolved: org.springframework.boot:spring-boot-starter-parent:pom:3.5.4 (present, but unavailable): Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:3.5.4 from/to nexus-cargo (http://maven.kgkj.com/repository/public/): ��֪�������������� (maven.kgkj.com) and 'parent.relativePath' points at no local POM @ line 5, column 10: Unknown host ��֪�������������� (maven.kgkj.com) -> [Help 2] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
08-21
C:\Users\xjy11\.jdks\corretto-1.8.0_452\bin\java.exe -Dmaven.multiModuleProjectDirectory=E:\workspace\ProjectCodings\xxl-job-2.3.1\xxl-job-executor-samples\xxl-job-executor-sample-springboot -Dmaven.home=C:\software\apache-maven-3.6.3 -Dclassworlds.conf=C:\software\apache-maven-3.6.3\bin\m2.conf "-Dmaven.ext.class.path=E:\develope\IDE\IntelliJ IDEA 2021.1.1\plugins\maven\lib\maven-event-listener.jar" "-javaagent:E:\develope\IDE\IntelliJ IDEA 2021.1.1\lib\idea_rt.jar=49938:E:\develope\IDE\IntelliJ IDEA 2021.1.1\bin" -Dfile.encoding=UTF-8 -classpath C:\software\apache-maven-3.6.3\boot\plexus-classworlds-2.6.0.jar;C:\software\apache-maven-3.6.3\boot\plexus-classworlds.license org.codehaus.classworlds.Launcher -Didea.version=2021.1.1 -s C:\software\apache-maven-3.6.3\conf\settings.xml -Dmaven.repo.local=C:\software\repository install [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] 'modelVersion' is missing. @ [unknown-group-id]:[unknown-artifact-id]:[unknown-version], C:\software\repository\org\springframework\boot\spring-boot-starter-parent\2.4.2\spring-boot-starter-parent-2.4.2.pom, line 1, column 8 [ERROR] 'groupId' is missing. @ [unknown-group-id]:[unknown-artifact-id]:[unknown-version], C:\software\repository\org\springframework\boot\spring-boot-starter-parent\2.4.2\spring-boot-starter-parent-2.4.2.pom, line 1, column 8 [ERROR] 'artifactId' is missing. @ [unknown-group-id]:[unknown-artifact-id]:[unknown-version], C:\software\repository\org\springframework\boot\spring-boot-starter-parent\2.4.2\spring-boot-starter-parent-2.4.2.pom, line 1, column 8 [ERROR] 'version' is missing. @ [unknown-group-id]:[unknown-artifact-id]:[unknown-version], C:\software\repository\org\springframework\boot\spring-boot-starter-parent\2.4.2\spring-boot-starter-parent-2.4.2.pom, line 1, column 8 [ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 41, column 21 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project com.xuxueli:xxl-job-executor-sample-springboot:2.3.0 (E:\workspace\ProjectCodings\xxl-job-2.3.1\xxl-job-executor-samples\xxl-job-executor-sample-springboot\pom.xml) has 5 errors [ERROR] 'modelVersion' is missing. @ [unknown-group-id]:[unknown-artifact-id]:[unknown-version], C:\software\repository\org\springframework\boot\spring-boot-starter-parent\2.4.2\spring-boot-starter-parent-2.4.2.pom, line 1, column 8 [ERROR] 'groupId' is missing. @ [unknown-group-id]:[unknown-artifact-id]:[unknown-version], C:\software\repository\org\springframework\boot\spring-boot-starter-parent\2.4.2\spring-boot-starter-parent-2.4.2.pom, line 1, column 8 [ERROR] 'artifactId' is missing. @ [unknown-group-id]:[unknown-artifact-id]:[unknown-version], C:\software\repository\org\springframework\boot\spring-boot-starter-parent\2.4.2\spring-boot-starter-parent-2.4.2.pom, line 1, column 8 [ERROR] 'version' is missing. @ [unknown-group-id]:[unknown-artifact-id]:[unknown-version], C:\software\repository\org\springframework\boot\spring-boot-starter-parent\2.4.2\spring-boot-starter-parent-2.4.2.pom, line 1, column 8 [ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 41, column 21 [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
07-02
### Spring Boot项目中的父级依赖问题解决方案 当遇到 `parent dependency 'Unknown:Unknown:Unknown'` 的问题时,通常是因为 Maven 或 Gradle 配置文件中缺少必要的配置或者版本定义不正确。以下是针对该问题的具体分析和解决方法。 #### 1. 检查Maven POM.xml 文件 如果使用的是 Maven 构建工具,则需要确认 `pom.xml` 中的 `<parent>` 节点是否正确设置。标准的 Spring Boot 父级依赖应该如下所示: ```xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.0</version> <!-- 替换为所需的Spring Boot版本 --> </parent> ``` 上述代码片段展示了如何正确引入 Spring Boot 的父级依赖[^1]。如果没有指定具体的版本号或存在拼写错误,可能会导致构建失败并提示 `'Unknown:Unknown:Unknown'` 错误。 #### 2. 使用Gradle的情况 对于采用 Gradle 进行管理的项目而言,在 `build.gradle` 文件里应加入以下插件声明以及对应的依赖项: ```groovy plugins { id 'org.springframework.boot' version '2.7.0' } dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' } ``` 这里需要注意的是,确保所使用的 Spring Boot 插件版本与实际需求一致,并且在脚本开头部分正确定义了 plugin 版本信息[^2]。 #### 3. 缓存清理与重新加载 无论是哪种构建方式,都建议执行缓存清除操作后再尝试更新依赖关系。例如,在命令行下运行以下指令来刷新本地仓库数据: - 对于Maven用户可以输入: ```bash mvn clean install -U ``` - 如果是Gradle环境则可键入: ```bash gradle --refresh-dependencies build ``` 这些措施有助于排除因网络传输异常等原因造成的临时性资源缺失状况。 #### 4. IDE 设置核查 最后还需留意开发环境中关于 SDK 和 JRE 的设定情况。某些情况下IDE内部预设路径可能指向不存在的位置从而引发连锁反应影响到整个工程结构解析过程。 --- ### 总结 综上所述,要彻底消除此类报错现象需逐一排查以上几个方面内容直至找到根本原因所在为止。只有保证基础框架搭建无误才能顺利开展后续业务逻辑编码工作。
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Run_the_ant

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值