Java 为什么从 Spring boot 版本 2.1.4 更改为 2.1.5 会出现未知配置 Maven 错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/56154266/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why does change from Spring boot version 2.1.4 to 2.1.5 gives unknown configuration Maven error?
提问by user2125853
I had installed Eclipse (actually Spring Tool Suite). It came with Maven. I had created Spring boot starter projects. Maven was downloading all the dependencies and things were working fine.
我已经安装了 Eclipse(实际上是 Spring Tool Suite)。它随 Maven 一起提供。我创建了 Spring boot 启动项目。Maven 正在下载所有依赖项,并且一切正常。
Recently, I created a new project. This time, I noticed an error in pom.xml and the problem window (in STS) showing the following:
最近,我创建了一个新项目。这一次,我注意到 pom.xml 中的一个错误和问题窗口(在 STS 中)显示以下内容:
Description Resource Path Location Type
Unknown pom.xml /TestSessionAttribute line 1 Maven Configuration Problem
I noticed that the spring boot version was at 2.1.5 (it was 2.1.4 before).
我注意到spring boot版本是2.1.5(之前是2.1.4)。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
I went ahead and did an update of the project (Maven > Update project) with the 'Force Update of Snapshots/Releases' checked. This did not resolve the problem. I do see the
我继续对项目(Maven > 更新项目)进行了更新,并选中了“强制更新快照/发布”。这并没有解决问题。我确实看到了
spring-boot-2.1.5.RELEASE.jar
in the m2 repository.
在 m2 存储库中。
I went back and changed the version to 2.1.4 and then a Maven > Update Project and the errors went away.
我回去将版本更改为 2.1.4,然后是 Maven > 更新项目,错误消失了。
Why am I getting the Maven error when version is 2.1.5?
当版本为 2.1.5 时,为什么会出现 Maven 错误?
采纳答案by ST-DDT
According to thislink you can fix the issue by downgrading the maven-jar-plugin to 3.1.1 (from 3.1.2). I can confirm that the fix works for my own projects.
根据此链接,您可以通过将 maven-jar-plugin 降级到 3.1.1(从 3.1.2)来解决该问题。我可以确认该修复程序适用于我自己的项目。
Add the following entry to your pom to fix that issue.
将以下条目添加到您的 pom 以解决该问题。
<properties>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
An official bug entry for eclipseexists as well.
回答by mailq
I don't know whyit is broken. I guess it is a broken setting in the eclipse project.
不知道为什么坏了 我想这是 eclipse 项目中的一个坏设置。
I only know how to solve it:
我只知道怎么解决:
- Keep 2.1.5.RELEASE in the pom.xml
- Close eclipse
- run
mvn clean eclipse:clean eclipse:eclipse
- Start eclipse
- 在 pom.xml 中保留 2.1.5.RELEASE
- 关闭日食
- 跑
mvn clean eclipse:clean eclipse:eclipse
- 开始日食
So all the eclipse related settings will be recreated. It then works as intended. After that you can even "downgrade" the spring version, and it keeps working.
因此将重新创建所有与 Eclipse 相关的设置。然后它按预期工作。之后,您甚至可以“降级” spring 版本,它会继续工作。