【问题标题】:Maven pom.xml errorMaven pom.xml 错误
【发布时间】:2017-06-26 14:59:13
【问题描述】:

使用mvn -X validate 命令时出现以下错误:

The POM for org.apache.maven.plugins:maven-jar-plugin:jar:2.3.1 is invalid, transitive dependencies (if any) will not be available: 3 problems were encountered while building the effective model for org.apache.maven.plugins:maven-jar-plugin:2.3.1
[ERROR] Invalid packaging for parent POM org.apache.maven.plugins:maven-jar-plugin:2.3.1, must be "pom" but is "maven-plugin" @
[ERROR] Invalid packaging for parent POM org.apache.maven.plugins:maven-jar-plugin:2.3.1, must be "pom" but is "maven-plugin" @
[FATAL] The parents form a cycle: org.apache.maven.plugins:maven-jar-plugin:2.3.1 -> org.apache.maven.plugins:maven-jar-plugin:2.3.1 @

我的环境如下:

mvn --version
> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
> 2015-11-10T11:41:47-05:00) Maven home:
> C:\apache-maven-3.3.9\apache-maven-3.3.9 Java version: 1.8.0_65,
> vendor: Oracle Corporation Java home: C:\Program
> Files\Java\jdk1.8.0_65\jre Default locale: en_US, platform encoding:
> Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family:
> "dos"

我的 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>com.biomerieux</groupId>
        <artifactId>instrument-parent</artifactId>
        <!--packaging>pom</packaging>-->
        <version>0.1.0</version>
        <!--name>Instrument</name>-->
    </parent>
    <!-- <modelVersion>4.0.0</modelVersion> -->

    <artifactId>GenomeHardware</artifactId>
        <version>1.0.0</version>
    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <!-- packaging>maven-plugin</packaging -->
                <configuration>
                    <outputDirectory>../NewtonGenomeHardware</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

我一直在寻找答案,到目前为止,没有运气。提前致谢。

【问题讨论】:

  • 请也分享父pom

标签: maven-3


【解决方案1】:

确保父 pom.xml

<packaging>pom</packaging>

更多详情请查看What is "pom" packaging in maven?

【讨论】:

    猜你喜欢
    • 2016-10-03
    • 2023-03-26
    • 2014-04-04
    • 2016-07-03
    • 1970-01-01
    • 1970-01-01
    • 2016-05-02
    • 2017-08-05
    • 1970-01-01
    相关资源
    最近更新 更多