Maven POM.xml问题-顶行出现未知错误(<?xml版本="1.0"编码="UTF-8"?>) [英] Maven POM.xml problem - Unknown error at top line ( <?xml version="1.0" encoding="UTF-8"?> )

查看:130
本文介绍了Maven POM.xml问题-顶行出现未知错误(<?xml版本="1.0"编码="UTF-8"?>)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am setting up a project in STS with Spring starter project and added required dependencies like spring security and JSP. But the top line of pom file throwing an error as Unknown

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

Can anybody help me out to resolve this?

我正在使用STS 4

I am using 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>

通常这应该可以正常工作

Usually this should work without any error

推荐答案

这是最新的惊喜maven-jar-plugin升级到3.1.2

This is the latest surprise Eclipse bug when using with Spring Boot 2.1.5 due to Spring Boot 2.1.5 upgrade maven-jar-plugin to 3.1.2

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

The workaround is to downgrade it to the previous version by adding the following to pom.xml :

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

这篇关于Maven POM.xml问题-顶行出现未知错误(&lt;?xml版本="1.0"编码="UTF-8"?&gt;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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