当前位置: 首页 > 知识库问答 >
问题:

为什么我会得到这个错误?消息:无法读取代码第一行的pom.xml

丁德义
2023-03-14
<?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 https://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.2.4.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.example</groupId>
        <artifactId>temp</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>Temp</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-data-jpa</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>

            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.junit.vintage</groupId>
                        <artifactId>junit-vintage-engine</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>

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

    </project>

像这样

org.eclipse.core.runtime.coreException:无法在org.eclipse.m2e.core.internal.embedder.mavenimpl.readModel(mavenimpl.java:565)在org.eclipse.m2e.core.internal.embedder.mavenimpl.readModel(mavenimpl.java:574)在org.eclipse.m2e.core.embedder.mavenimpl.java.refreshPhase2(ProjectRegistryManager.java:542)在eclipse.m2e.core.internal.project.registrymanager.refresh(ProjectRegistryManager.java:351)在org.eclipse.m2e.core.internal.project.registry.projectRegistryManager.refresh(ProjectRegistryManager.java:298)在org.eclipse.m2e.core.internal.project.registry.projectRegistryManager.java:298)在al.embedder.MavenExecutionContext.ExecuteBare(MavenExecutionContext.java:176)at在org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(mavenExecutionContext.java:151)在org.eclipse.m2e.core.internal.embedder.mavenExecutionContext.execute(mavenExecutionContext.java:99)在org.eclipse.m2e.core.internal.embedder.mavenExecutionContext.java:99)在re.runtime.saferunner.run(saferunner.java:42),org.eclipse.core.internal.events.buildmanager.basicbuild(buildmanager.java:205),org.eclipse.core.internal.events.buildmanager.basicbuild(buildmanager.java:245),org.eclipse.core.internal.events.buildmanager.basicbuild(basicBuildLoop(BuildManager.java:359)在org.eclipse.core.internal.events.buildmanager.build(buildmanager.java:382)在org.eclipse.core.internal.events.autobuildjob.doBuild(autobuildjob.java:144)在org.eclipse.core.internal.events.autobuildjob.java:144)在org.eclipse.core.internal.events.autobuildjob.run(autobuildjob.java:235)在@65:9)在org.apache.maven.model.io.defaultModelReader.read(defaultModelReader.java:122),org.apache.maven.model.io.defaultModelReader.read(defaultModelReader.java:86),org.eclipse.m2e.core.internal.embedder.mavenimpl.readModel(mavenimpl.java:563)...24更多原因是:@65:9)在org.apache.maven.model.io.xpp3.mavenxpp3reader.checkfieldWithDuplicat(mavenxpp3reader.java:140)在org.apache.maven.model.io.xpp3.mavenxpp3reader.java:140)在org.apache.maven.model.io.xpp3.mavenxpp3reader.parsemodel(mavenxpp3reader.java:2275)在ModelReader.java:117)...26个以上

共有1个答案

顾宸
2023-03-14

消息显示,在您的pom.xml第65行的 中有一个重复的 标记:

重复的标记:“build”(位置:START_TAG已看到...\n\n\t...@65:9)

但是,您发布的pom.xml完全没有问题。也许您的项目中有另一个pom.xml

 类似资料: