【问题标题】:Why does pom.xml file give an unknown error为什么 pom.xml 文件给出未知错误
【发布时间】:2019-10-08 13:26:58
【问题描述】:

我正在尝试学习 Spring Boot 并将 Spring Boot 安装到 Eclipse IDE。当我创建我的第一个项目时,它在 pom.xml 的第一行显示错误。它显示为未知错误。

我尝试了许多来自 stackoverflow 的解决方案。但它们都不适合我。

Maven pom.xml error in eclipse When maven says "resolution will not be reattempted until the update interval of MyRepo has elapsed", where is that interval specified?

我的 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>
<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>

谁能帮我解决这个问题。

【问题讨论】:

  • 使用 -X 参数运行 maven 以获得更多调试信息和共享。例如, mvn -e -X clean package
  • 可以添加错误信息吗?
  • @akuma8 org.apache.maven.lifecycle.MissingProjectException: 你指定的目标需要一个项目来执行但是这个目录下没有POM
  • 你跑了什么目标,你在哪里跑的? there is no POM in this directory
  • 该错误表示您尝试在文件夹(项目)中运行maven命令但没有pom.xml。

标签: spring-boot pom.xml


【解决方案1】:

两周前我遇到了同样的问题。然后,我通过添加如下一行来修复它

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

而且似乎这个错误已经在 Eclipse 中修复了。
只需更新您的 Eclipse 或 STS4。您可能会看到 m2e connector 包含在更新列表中。

【讨论】:

    猜你喜欢
    • 2019-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-20
    • 1970-01-01
    • 1970-01-01
    • 2016-09-29
    相关资源
    最近更新 更多