Maven:每个标签上出现不可解析的 POM 无法识别的标签错误

Posted

技术标签:

【中文标题】Maven:每个标签上出现不可解析的 POM 无法识别的标签错误【英文标题】:Maven: Non-parseable POM unrecognized tag error appearing on every tag 【发布时间】:2017-02-22 20:37:54 【问题描述】:

我觉得自己像个真正的菜鸟,我真的很难过。我可能也需要休息一下-_-

我的代码不断收到此错误,“Non-parseable POM H:\Desktop\com.objectdb.tutorial.spring_KUmoduleMarks\pom.xml: Unrecognized tag: “依赖”(位置:已看到 START_TAG ...\n ...@45:29)

<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-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.objectdb.tutorial.spring</groupId>
<artifactId>Guestbook</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>Guestbook</name>
<url>http://maven.apache.org</url>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<repositories>
    <repository>
        <id>objectdb</id>
        <name>ObjectDB Repository</name>
        <url>http://m2.objectdb.com</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.objectdb</groupId>
        <artifactId>objectdb</artifactId>
                    <version>2.6.3</version>
<!--            <version>2.6.2_02</version>-->
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>javax.persistence</artifactId>
        <version>2.1.0</version>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>
            <dependency>
                <groupId>javax.persistence</groupId>
                <artifactId>Entity</artifactId>
                <version>1.1</version>
            <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
        <artifactId>spring-stereotype</artifactId>
        <version>3.0.5.RELEASE</version>
            </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>3.0.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>aopalliance</groupId>
        <artifactId>aopalliance</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2</version>
    </dependency>
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.6.10</version>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>enhance</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>com.objectdb.Enhancer</mainClass>
                            <arguments>
                                <argument>guest.Guest</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.10</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <stopKey>foo</stopKey>
                    <stopPort>9999</stopPort>
                </configuration>
                <executions>
                    <execution>
                        <id>start-jetty</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <scanIntervalSeconds>0</scanIntervalSeconds>
                            <daemon>true</daemon>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-jetty</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
    <finalName>Guestbook</finalName>
</build>

</project>

我是否使用了不正确的语法?有没有我完全错过的关键步骤/概念?

【问题讨论】:

是否缺少“”结束标记只是因为您没有复制粘贴整个 pom? 是的,我的错。我没有粘贴整个pom。谢谢。 【参考方案1】:

对我来说问题似乎是这部分:

    <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>Entity</artifactId>
        <version>1.1</version>
//Closing tag?
<dependency> 
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
</dependency>

【讨论】:

【参考方案2】:

javax.persistence:Entity&lt;dependency&gt; 标签未关闭。

【讨论】:

以上是关于Maven:每个标签上出现不可解析的 POM 无法识别的标签错误的主要内容,如果未能解决你的问题,请参考以下文章

报错: eclipse加载maven工程提示pom.xml无法解析org.apache.maven.plugins:maven-resources-plugin:2.3.2

处理 POM 时出现 Maven 错误:[致命] 不可解析的 POM...PITarget 带有保留的 xml 名称

eclipse加载maven工程提示pom.xml无法解析

使用 Maven 3.0.3 和 relativePath 表示法的不可解析的父 POM

项目构建错误:不可解析的父 POM

Maven 子项目 - 不可解析的父 POM