Bravo
Bravo

Reputation: 1139

Cyclic reference error in maven

Good day,

I am getting an error saying: 'The projects in the reactor contain a cyclic reference'.

Parent pom.xml:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.solveit.cmr</groupId>
    <artifactId>cmr-parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>cmr-parent</name>

    <modules>
        <module>cmr-core</module>
    </modules>

    <dependencies>

        <dependency>
            <groupId>com.solveit.cmr.core</groupId>
            <artifactId>cmr-core</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
</project>

child pom:

<modelVersion>4.0.0</modelVersion>
<artifactId>cmr-core</artifactId>
<name>cmr-core</name>
<groupId>com.solveit.cmr.core</groupId>


<parent>
    <groupId>com.solveit.cmr</groupId>
    <artifactId>cmr-parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</parent>

How can I fix this problem?

Thank you

Upvotes: 4

Views: 6580

Answers (1)

igreenfield
igreenfield

Reputation: 1702

The <modules> section tell maven the hierarchy between the parent pom and childs pom.
The parent should contain all the common section to all the modules.
such as <dependencyManagement>, <plugins> and <properties>

Upvotes: 1

Related Questions