Maven POM.xml问题-顶部错误(<?xml version =“ 1.0” encoding =“ UTF-8”?>)

时间:2019-06-05 07:21:58

标签: spring-boot pom.xml

我正在使用Spring starter项目在STS中建立一个项目,并添加了必需的依赖项,例如spring安全性和JSP。但是pom文件的最上面一行抛出错误未知

有人可以帮我解决这个问题吗?

我正在使用STS 4

<?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>RememberMeApp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>RememberMeApp</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-security</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-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-mavenplugin</artifactId>
        </plugin>
    </plugins>
    </build>
</project>

通常这应该可以正常工作

2 个答案:

答案 0 :(得分:0)

由于Spring Boot 2.1.5已将maven-jar-plugin升级到3.1.2,这是与Spring Boot 2.1.5一起使用时的最新惊喜Eclipse bug

解决方法是通过将以下内容添加到pom.xml中来将其降级到以前的版本:

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

答案 1 :(得分:0)

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.4.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>