Search code examples
javamavenjenkinspom.xmlparent-pom

How to add relative path to the original parent in maven


I added to my parent pom a submodule that was fork from the open source community. It has it's own parent. that is throwing the following:

[ERROR] Failed to read Maven project: 2 problems were encountered while building the effective model for com.offbytwo.jenkins:jenkins-client:0.2.1.302.1 [WARNING] 'parent.relativePath' points at com.verigreen:verigreen-root instead of org.sonatype.oss:oss-parent, please verify your project structure @ line 18, column 10 [FATAL] Non-resolvable parent POM: Failure to transfer org.sonatype.oss:oss-parent:pom:7 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.sonatype.oss:oss-parent:pom:7 from/to central (http://repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom and 'parent.relativePath' points at wrong local POM @ line 18, column 10 for project com.offbytwo.jenkins:jenkins-client:0.2.1.302.1 at C:\Verigreen\VG_test_branches\jenkins-client\pom.xml

My parent pom looks like that:

<artifactId>verigreen-root</artifactId>
    <version>1.6.1-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>verigreen</name>
    .
    .
    <modules>
        <module>jenkins-client</module>
        <module>vg-common</module>

The jenkins-client pom looks like that:

<name>Jenkins Client</name>
    <url>http://github.com/RisingOak/jenkins-client</url>
    <description>A Jenkins API client for Java</description>

    <groupId>com.offbytwo.jenkins</groupId>
    <artifactId>jenkins-client</artifactId>
    <version>0.2.1.302.1</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

How can I point to the parent pom?


Solution

  • You have the info of the parent wrong, change it to this:

    <parent>
        <groupId>com.verigreen</groupId>
        <artifactId>verigreen-root</artifactId>
        <version>1.6.1-SNAPSHOT</version>
    </parent>
    

    And add this (in case it's not there) on the parent pom:

    <groupId>com.verigreen</groupId>