为什么我在 pom.xml 的第 1 行收到未知错误?
Why am I getting Unknown error in line 1 of pom.xml?
在 Eclipse IDE 中 pom.xml
的第 1 行出现未知错误。
直到昨天它都运行良好,但是在从 master 更新我的项目并修复合并冲突后突然在 pom.xml 中获得 "Unknown error"。
除了我,我的 none 队友都面临这个问题。我还更改了工作区,删除了缓存,但仍然没有成功。
我正在为这个项目使用 h2 数据库,尽管在 data.sql 中插入了值,但它没有获取任何值并插入到 h2 数据库表中。在此问题之前,它工作正常。我觉得这是由于 pom.xml 中的问题所致,但我不确定。请帮助
我删除了现有的项目并从master那里获取了最新的代码。之后删除了用户下的 .m2 文件夹,包括存储库文件夹。我确实更新了项目并启用了 snapshots/releases 的强制更新、maven clean 和 maven build。但没有任何帮助。
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.roster</groupId>
<artifactId>spring-boot-roster-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-boot-roster-app</name>
<description>Demo project for Spring Boot Roster</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<!-- <start-class>com.infosys.roster.SpringBootRosterAppApplication</start-class> -->
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!--encryption lib -->
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt-springsecurity3</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.hibernate</groupId> -->
<!-- <artifactId>hibernate-core</artifactId> -->
<!-- <version>5.2.10.Final</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>io.springfox</groupId> -->
<!-- <artifactId>springfox-swagger2</artifactId> -->
<!-- <version>2.7.0</version> -->
<!-- <scope>compile</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>io.springfox</groupId> -->
<!-- <artifactId>springfox-swagger-ui</artifactId> -->
<!-- <version>2.7.0</version> -->
<!-- <scope>compile</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>io.springfox</groupId> -->
<!-- <artifactId>springfox-data-rest</artifactId> -->
<!-- <version>2.7.0</version> -->
<!-- </dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
application.properties
server.port=
spring.h2.console.path=/h2
spring.h2.console.enabled=true
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.platform=h2
spring.datasource.initialization-mode=always
spring.jpa.hibernate.ddl-auto=update
spring.datasource.continue-on-error=true
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
应该删除 pom.xml 中的未知错误,而且我必须能够在 H2 数据库中填充值。
虽然我无法重现您的错误(您的 none 队友也可以),但我有一个建议,可能会对您有所帮助。
你听说过Byte Order Mark吗?正如它出现在第 1 行中一样,它很可能是您遇到麻烦的候选者。也许您在某处更改了某个设置,但不知何故导致了错误。我认为维基百科文章中的这句话特别相关:
BOM use is optional. Its presence interferes with the use of UTF-8 by software that does not expect non-ASCII bytes at the start of a file but that could otherwise handle the text stream.
对我来说,我更改了 pom.xml 的父标签并解决了它
将 2.1.5 更改为 2.1.4,然后 Maven-> 更新项目
对我来说,我更改了 pom.xml 的父标签,它解决了 change 2.1.5 to 2.1.4
然后 Maven-> Update Project
。它也对我有用。
There is a bug about Eclipse and spring-boot-starter-parent 2.1.5
"if the maven packaging attribute is war then no problem.The problem is in jar type." 所以你也可以通过改变包装类型来解决这个问题
<packaging>war</packaging>
根据当前状态回答
This issue 已修复:
Please install the m2e connector for mavenarchiver plugin 0.17.3 from https://download.eclipse.org/m2e-wtp/releases/1.4/
已过时的答案
比从 Spring 引导 2.1.5.RELEASE
降级到 2.1.4.RELEASE
更不深刻的变化只是将 the affected Maven JAR Plugin 从 3.1.2
降级到 3.1.1
只要这个错误存在:
<properties>
<!-- ... -->
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
根据@Shravani 的建议,在我的 pom.xml 文件中,我更改了该区域中的版本号:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
对此:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
然后我右键单击该项目并执行了 'Maven -> Update project...'。这让我的问题消失了。
我也遇到同样的问题,来自 spring 入门演示的原始代码在第 1 行给出了未知错误:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
...
仅将 2.1.6.RELEASE 的版本更改为 2.1.4.RELEASE 即可解决问题。
在 eclipse IDE 版本 4.10,Spring 引导 2.2.0.M4 上遇到此错误,将 Spring 引导版本更改为 2.2.0.M2(在许多其他解决方案之后推荐并解决了错误)。最新版本的 Spring 启动启动项目模块 maven POM 中可能缺少或损坏了某些东西。
In my pom.xml file I had to downgrade the version from 2.1.6.RELEASE for
spring-boot-starter-parent artifact to 2.1.4.RELEASE
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
将更改为
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
那个奇怪的未知错误消失了
我通过 help
> check for update
.
更新了 spring 工具套装
对我来说,从 2.1 开始为 SpringBoot 2 项目更改 pom.xml。6.RELEASE
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.REL`enter code here`EASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
到 2.1.4.RELEASE 已验证并有效
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
您必须升级 m2e 连接器。
这是一个已知错误,但有一个解决方案:
进入 Eclipse 单击“帮助”>“安装新软件...”
出现一个window。在“安装”中window:
2a。在“Work with”输入框中输入下一个站点位置并按Enter
https://download.eclipse.org/m2e-wtp/releases/1.4/
2b。出现很多信息进入“姓名”输入框。 Select 所有项目
2c。单击“下一步”按钮。
完成安装并重新启动 Eclipse。
将 3.1.1 添加到如下属性中,然后修复问题
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
只需更新项目 => 右键单击 => Maven => 更新项目
您只需要一个最新的 Eclipse 或 Spring 工具套件 4.5 和 above.Nothing else.refresh 项目就可以了
我在版本 3 中遇到了同样的错误。在 将 STS 升级到最新版本:4.5.1.RELEASE 后它起作用了。无需更改最新 STS 中的代码或配置。
以下操作对我有用。
1.Go 到工具栏中的项目 -> 未选中 "Build Automatically"
2.In POM 文件,将 spring-boot 版本降级到 2.1.4 RELEASE。
3.Right 单击项目名称 -> Select Maven -> 单击 "Update Project"。 ->确定
等待所有 Maven 依赖项下载完成(需要互联网)。
每当您遇到此类错误时,只需更改
发布版本就像
在我的情况下,它在 2.2.7 中显示错误我更改为 2.2.6
问题:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.7.RELEASE</version>
解决方案:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
在 属性 标签中添加 3.1.1
问题解决
https://medium.com/@saannjaay/unknown-error-in-pom-xml-66fb2414991b
只需在 pom.xml 的属性标签中添加下面的 maven jar 版本,
3.1.1
然后按照以下步骤操作,
第一步:mvn clean
第 2 步:更新项目
问题帮我解决了!你也应该试试这个:)
我的愚蠢解决方案是“删除”问题列表中的错误消息。
右键单击 => select 删除,您会收到一条 warning 消息,说它可能会恢复。
但是即使我做了一个干净的错误信息也没有返回
和全部构建。
TLDR:
我从命令行执行了以下操作
"mvn clean" 结果:无错误
"mvn compile" 结果:在目标文件夹中生成 Jar。
结果:屏幕上没有错误。
所以错误是在eclipse中而不是在pom.xml
我尝试了以下方法:
更新项目=>右击=>Maven=>更新项目
项目 => 清理
自动构建导致相同的错误消息。
我尝试在 pom.xml 中将包装从罐子更改为 war
重建...仍然是相同的错误信息。
我尝试了“升级 m2e 连接器”选项。
重建...仍然是相同的错误信息。
我试过关闭自动重建、清理并退出 Eclipse。
重启Eclipse,Build all...还是一样的错误信息。
也许上面的其中一个为我修复了它只是没有正确更新或清除 Eclipse 中的问题日志。
如果有人在 VS Code 中遇到类似问题,请按照以下步骤操作:
打开 pom.xml >> 右键单击并 select“更新项目”
在 Eclipse IDE 中 pom.xml
的第 1 行出现未知错误。
直到昨天它都运行良好,但是在从 master 更新我的项目并修复合并冲突后突然在 pom.xml 中获得 "Unknown error"。
除了我,我的 none 队友都面临这个问题。我还更改了工作区,删除了缓存,但仍然没有成功。
我正在为这个项目使用 h2 数据库,尽管在 data.sql 中插入了值,但它没有获取任何值并插入到 h2 数据库表中。在此问题之前,它工作正常。我觉得这是由于 pom.xml 中的问题所致,但我不确定。请帮助
我删除了现有的项目并从master那里获取了最新的代码。之后删除了用户下的 .m2 文件夹,包括存储库文件夹。我确实更新了项目并启用了 snapshots/releases 的强制更新、maven clean 和 maven build。但没有任何帮助。
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.roster</groupId>
<artifactId>spring-boot-roster-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-boot-roster-app</name>
<description>Demo project for Spring Boot Roster</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<!-- <start-class>com.infosys.roster.SpringBootRosterAppApplication</start-class> -->
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!--encryption lib -->
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt-springsecurity3</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.hibernate</groupId> -->
<!-- <artifactId>hibernate-core</artifactId> -->
<!-- <version>5.2.10.Final</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>io.springfox</groupId> -->
<!-- <artifactId>springfox-swagger2</artifactId> -->
<!-- <version>2.7.0</version> -->
<!-- <scope>compile</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>io.springfox</groupId> -->
<!-- <artifactId>springfox-swagger-ui</artifactId> -->
<!-- <version>2.7.0</version> -->
<!-- <scope>compile</scope> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>io.springfox</groupId> -->
<!-- <artifactId>springfox-data-rest</artifactId> -->
<!-- <version>2.7.0</version> -->
<!-- </dependency> -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
application.properties
server.port=
spring.h2.console.path=/h2
spring.h2.console.enabled=true
spring.datasource.url=
spring.datasource.username=
spring.datasource.password=
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.platform=h2
spring.datasource.initialization-mode=always
spring.jpa.hibernate.ddl-auto=update
spring.datasource.continue-on-error=true
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
应该删除 pom.xml 中的未知错误,而且我必须能够在 H2 数据库中填充值。
虽然我无法重现您的错误(您的 none 队友也可以),但我有一个建议,可能会对您有所帮助。
你听说过Byte Order Mark吗?正如它出现在第 1 行中一样,它很可能是您遇到麻烦的候选者。也许您在某处更改了某个设置,但不知何故导致了错误。我认为维基百科文章中的这句话特别相关:
BOM use is optional. Its presence interferes with the use of UTF-8 by software that does not expect non-ASCII bytes at the start of a file but that could otherwise handle the text stream.
对我来说,我更改了 pom.xml 的父标签并解决了它 将 2.1.5 更改为 2.1.4,然后 Maven-> 更新项目
对我来说,我更改了 pom.xml 的父标签,它解决了 change 2.1.5 to 2.1.4
然后 Maven-> Update Project
。它也对我有用。
There is a bug about Eclipse and spring-boot-starter-parent 2.1.5
"if the maven packaging attribute is war then no problem.The problem is in jar type." 所以你也可以通过改变包装类型来解决这个问题
<packaging>war</packaging>
根据当前状态回答
This issue 已修复:
Please install the m2e connector for mavenarchiver plugin 0.17.3 from https://download.eclipse.org/m2e-wtp/releases/1.4/
已过时的答案
比从 Spring 引导 2.1.5.RELEASE
降级到 2.1.4.RELEASE
更不深刻的变化只是将 the affected Maven JAR Plugin 从 3.1.2
降级到 3.1.1
只要这个错误存在:
<properties>
<!-- ... -->
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
根据@Shravani 的建议,在我的 pom.xml 文件中,我更改了该区域中的版本号:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
对此:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
然后我右键单击该项目并执行了 'Maven -> Update project...'。这让我的问题消失了。
我也遇到同样的问题,来自 spring 入门演示的原始代码在第 1 行给出了未知错误:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
...
仅将 2.1.6.RELEASE 的版本更改为 2.1.4.RELEASE 即可解决问题。
在 eclipse IDE 版本 4.10,Spring 引导 2.2.0.M4 上遇到此错误,将 Spring 引导版本更改为 2.2.0.M2(在许多其他解决方案之后推荐并解决了错误)。最新版本的 Spring 启动启动项目模块 maven POM 中可能缺少或损坏了某些东西。
In my pom.xml file I had to downgrade the version from 2.1.6.RELEASE for spring-boot-starter-parent artifact to 2.1.4.RELEASE
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
将更改为
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
那个奇怪的未知错误消失了
我通过 help
> check for update
.
对我来说,从 2.1 开始为 SpringBoot 2 项目更改 pom.xml。6.RELEASE
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.6.REL`enter code here`EASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
到 2.1.4.RELEASE 已验证并有效
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.4.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
您必须升级 m2e 连接器。 这是一个已知错误,但有一个解决方案:
进入 Eclipse 单击“帮助”>“安装新软件...”
出现一个window。在“安装”中window:
2a。在“Work with”输入框中输入下一个站点位置并按Enter https://download.eclipse.org/m2e-wtp/releases/1.4/
2b。出现很多信息进入“姓名”输入框。 Select 所有项目
2c。单击“下一步”按钮。
完成安装并重新启动 Eclipse。
将 3.1.1 添加到如下属性中,然后修复问题
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
只需更新项目 => 右键单击 => Maven => 更新项目
您只需要一个最新的 Eclipse 或 Spring 工具套件 4.5 和 above.Nothing else.refresh 项目就可以了
我在版本 3 中遇到了同样的错误。在 将 STS 升级到最新版本:4.5.1.RELEASE 后它起作用了。无需更改最新 STS 中的代码或配置。
以下操作对我有用。
1.Go 到工具栏中的项目 -> 未选中 "Build Automatically"
2.In POM 文件,将 spring-boot 版本降级到 2.1.4 RELEASE。
3.Right 单击项目名称 -> Select Maven -> 单击 "Update Project"。 ->确定 等待所有 Maven 依赖项下载完成(需要互联网)。
每当您遇到此类错误时,只需更改 发布版本就像 在我的情况下,它在 2.2.7 中显示错误我更改为 2.2.6
问题:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.7.RELEASE</version>
解决方案:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
在 属性 标签中添加
问题解决
https://medium.com/@saannjaay/unknown-error-in-pom-xml-66fb2414991b
只需在 pom.xml 的属性标签中添加下面的 maven jar 版本,
然后按照以下步骤操作,
第一步:mvn clean
第 2 步:更新项目
问题帮我解决了!你也应该试试这个:)
我的愚蠢解决方案是“删除”问题列表中的错误消息。
右键单击 => select 删除,您会收到一条 warning 消息,说它可能会恢复。 但是即使我做了一个干净的错误信息也没有返回 和全部构建。
TLDR:
我从命令行执行了以下操作 "mvn clean" 结果:无错误
"mvn compile" 结果:在目标文件夹中生成 Jar。 结果:屏幕上没有错误。
所以错误是在eclipse中而不是在pom.xml
我尝试了以下方法:
更新项目=>右击=>Maven=>更新项目
项目 => 清理 自动构建导致相同的错误消息。
我尝试在 pom.xml 中将包装从罐子更改为 war 重建...仍然是相同的错误信息。
我尝试了“升级 m2e 连接器”选项。 重建...仍然是相同的错误信息。
我试过关闭自动重建、清理并退出 Eclipse。 重启Eclipse,Build all...还是一样的错误信息。
也许上面的其中一个为我修复了它只是没有正确更新或清除 Eclipse 中的问题日志。
如果有人在 VS Code 中遇到类似问题,请按照以下步骤操作: 打开 pom.xml >> 右键单击并 select“更新项目”