【问题标题】:When I generate Spring starter project with eclipse STS tools there is an error occurs in pom.xml first line. But I found no error in pom.xml当我使用 eclipse STS 工具生成 Spring starter 项目时,pom.xml 第一行出现错误。但我在 pom.xml 中没有发现错误
【发布时间】:2019-10-20 06:04:37
【问题描述】:

我在创建项目后使用eclipse STS工具创建了一个Spring starter项目,首先在pom.xml中有错误。但我没有发现错误。我已尝试使用和不使用强制更新项目,但错误仍然存​​在

谢谢


<?xml version="1.0" encoding="UTF-8"?> <!-- error occurs here -->
<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.web-app</groupId>
    <artifactId>FirstWebApp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>FirstWebApp</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-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </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>


项目运行但不工作。 [这是eclipse工作区的图片][1]:https://i.stack.imgur.com/a9fGB.png

【问题讨论】:

  • 从spring initializr创建项目时出现同样的问题

标签: eclipse maven pom.xml spring-tool-suite


【解决方案1】:

嗯,这是使用 Spring Boot 2.1.5 时 Eclipse 的最新 well known problem

解决方法是将以下内容添加到pom.xml

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

【讨论】:

  • 谢谢。问题消失了
  • @ankurpramanik,很高兴听到。所以考虑接受我的答案或给我投票??
猜你喜欢
  • 2019-10-21
  • 2021-08-22
  • 2012-06-11
  • 1970-01-01
  • 2021-11-15
  • 2016-02-05
  • 1970-01-01
  • 2016-02-21
  • 2019-10-04
相关资源
最近更新 更多