新建一個(gè)測(cè)試項(xiàng)目摩钙,發(fā)現(xiàn)創(chuàng)建完畢pom.xml文件報(bào)錯(cuò)罢低,提示
Description Resource Path Location Type
Unknown pom.xml /demo line 1 Maven Configuration Problem
下面是文件,
<?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.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>?
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
檢查完畢發(fā)現(xiàn)是版本問(wèn)題,改成<version>2.0.0.RELEASE</version>就不會(huì)報(bào)錯(cuò)
或者?
解決這個(gè)問(wèn)題只需要网持,在pom.xml 文件中的 properties 加入maven jar 插件的版本號(hào)宜岛,如下所示:
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
主要原因是2.1.5.RELEASE 升級(jí)到了。3.1.2 造成的問(wèn)題功舀,有些IDE插件不兼容的問(wèn)題造成的萍倡。