为什么从 Spring boot 版本 2.1.4 更改为 2.1.5 会出现未知配置 Maven 错误? [英] Why does change from Spring boot version 2.1.4 to 2.1.5 gives unknown configuration Maven error?

查看:20
本文介绍了为什么从 Spring boot 版本 2.1.4 更改为 2.1.5 会出现未知配置 Maven 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了 Eclipse(实际上是 Spring Tool Suite).它随 Maven 一起提供.我创建了 Spring boot 启动项目.Maven 正在下载所有依赖项,一切正常.

最近,我创建了一个新项目.这一次,我注意到 pom.xml 中的一个错误以及显示以下内容的问题窗口(在 STS 中):

描述资源路径位置类型未知 pom.xml/TestSessionAttribute line 1 Maven 配置问题

我注意到spring boot版本是2.1.5(之前是2.1.4).

<groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.1.5.RELEASE</version><relativePath/><!-- 从存储库中查找父级 --></父母>

我继续更新项目(Maven > 更新项目),并选中强制更新快照/发布".这并没有解决问题.我确实看到了

spring-boot-2.1.5.RELEASE.jar

在 m2 存储库中.

我回去将版本更改为 2.1.4,然后是 Maven > 更新项目,错误消失了.

当版本为 2.1.5 时,为什么我会收到 Maven 错误?

解决方案

根据 链接,您可以通过将 maven-jar-plugin 降级到 3.1.1(从 3.1.2)来解决该问题.我可以确认此修复程序适用于我自己的项目.

将以下条目添加到您的 pom 以解决该问题.

<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version></属性>

eclipse 的官方错误条目也存在.>

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.

Recently, I created a new project. This time, I noticed an error in pom.xml and the problem window (in STS) showing the following:

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).

<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

spring-boot-2.1.5.RELEASE.jar

in the m2 repository.

I went back and changed the version to 2.1.4 and then a Maven > Update Project and the errors went away.

Why am I getting the Maven error when version is 2.1.5?

解决方案

According to this link 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.

Add the following entry to your pom to fix that issue.

<properties>
    <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>

An official bug entry for eclipse exists as well.

这篇关于为什么从 Spring boot 版本 2.1.4 更改为 2.1.5 会出现未知配置 Maven 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆