tdon0352
tdon0352

Reputation: 11

Maven pom.xml error

I get the following error using the mvn -X validate command:

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 @

My environment is the following:

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"

My pom.xml is the following:

<?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>

I've been looking for an answer, so far , no luck. Thanks in advance.

Upvotes: 1

Views: 4675

Answers (1)

Naman
Naman

Reputation: 32036

Make sure the parent pom.xml has

<packaging>pom</packaging>

For further details do take a look at What is "pom" packaging in maven?

Upvotes: 1

Related Questions