Maven: Non-resolvable parent POM

406,930

Solution 1

Just for reference.

The joys of Maven.

Putting the relative path of the modules to ../pom.xml solved it.

The parent element has a relativePath element that you need to point to the directory of the parent. It defaults to ..

Solution 2

It can also be fixed by putting the correct settings.xml file into the ~/.m2/ directory.

Solution 3

Alternative reason also might be the parent artifact comes from repository which is not accessible from pom.xml, typically private repository. The solution was to provide that repository in pom.xml:

<repositories>
    <repository>
        <id>internal-repo</id>
        <name>internal repository</name>
        <url>https://my/private/repo</url>
        <layout>default</layout>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

In my case the problem was even more complicated due to Eclipse: the repository was active only in special profile (<profiles><profile><id>activate-private-repo</id><repositories>...) and Maven GUI in Eclipse didn't allow to set this profile through Ctrl+Alt+P shortcut.

The solution was to temporarily declare repository outside profile (unconditionally), launch Alt+F5 Maven Update Project, activate profile and put repository declaration back into profile. This is rather Eclipse bug, not Maven bug.

Solution 4

Just add <relativePath /> so the parent in pom should look like:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath />
    </parent>

Solution 5

Non-resolvable parent POM: This means you cannot resolve the parent repo.

Trun on debug mode:

[DEBUG] Reading global settings from **/usr/local/Cellar/maven/3.5.4/libexec/conf/settings.xml**
[DEBUG] **Reading user settings from /Users/username/.m2/settings.xml**
[DEBUG] Reading global toolchains from /usr/local/Cellar/maven/3.5.4/libexec/conf/toolchains.xml
[DEBUG] Reading user toolchains from /Users/username/.m2/toolchains.xml
[DEBUG] Using local repository at /Users/username/.m2/repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for /Users/username/.m2/repository
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:

Because the parent repo is not part of the maven central. The solution is specify a setting.xml in ~m2/ to help result the parent POM. /Users/username/.m2/settings.xml

In that XML, you might need to specify the repository information.

Share:
406,930
Will
Author by

Will

Updated on December 17, 2021

Comments

  • Will
    Will over 2 years

    I have my maven project setup as 1 shell projects and 4 children modules. When I try to build the shell. I get:

    [INFO] Scanning for projects...
    [ERROR] The build could not read 1 project -> [Help 1]
    [ERROR]   
    [ERROR] The project module1:1.0_A0 (C:\module1\pom.xml) has 1 error
    [ERROR] Non-resolvable parent POM: Failure to find shell:pom:1.0_A0 in http://nyhub1.ny.ssmb.com:8081/nexus/content/repositories/JBoss/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 5, column 11 -> [Help 2]
    

    If I try to build a lone module I get the same error only replace module1, with whatever module it was.

    Have them all referencing the parent in their poms.

    <parent>
        <artifactId>shell</artifactId>
        <groupId>converter</groupId>
        <version>1.0_A0</version>
    </parent>
    

    Here is the relevant parts of the shell pom:

    <groupId>converter</groupId>
    <artifactId>shell</artifactId>
    <version>1.0_A0</version>
    <packaging>pom</packaging>
    <name>shell</name>
    
    
    <modules>
        <module>module1</module>
        <module>module2</module>
        <module>module3</module>
        <module>module4</module>
    </modules>
    
  • Nicola Musatti
    Nicola Musatti over 12 years
    Yes. Using Maven requires that you know what you do, trial and error won't get you very far. On the other hand there are several good references available. This is one.
  • bsky
    bsky over 7 years
    So you added this <relativePath>..</relativePath> under <parent></parent> ?
  • Mario Kurzweil
    Mario Kurzweil about 7 years
    Thanks I tried it for a while to solve the problem. I took the relative path from ../pom.xml to ../<parent folder>/pom.xml.
  • Brain
    Brain over 6 years
    Exactly that solved my problem, thanks!!! But not by putting it into some directory, but pointing Eclipse to it in Preferences - Maven - User Settings.
  • LoranceChen
    LoranceChen over 6 years
    Same situation!private repo not added to the pom.
  • Gerold Broser
    Gerold Broser about 6 years
    This only works if the required parent POM has the same version as the sub-module's POM. This is not always the case.
  • Saran
    Saran almost 6 years
    Solved my problem too. Just have to make sure the settings are properly configured to maven.repo too..
  • Gi1ber7
    Gi1ber7 over 5 years
    Putting the <relativePath> would not necessary solve the problem if you are pointing to a private repository. Look down for Tomáš Záluský response for detail explanation.
  • Rolintocour
    Rolintocour over 5 years
    In my case, this parent module was not in the parent folder, I had to add in the child module <relativePath>../parent-module-dir</relativePath>
  • smilyface
    smilyface over 5 years
    Awesome ! Adding my repo details in settings xml worked. But why it's not taking from the pom xml (which has the same repo added in it) ?
  • Praneeth Peiris
    Praneeth Peiris about 5 years
    I'm trying to extend my main pom file to another one (for tests) in the same directory (same project). But this doesn't solve this error. Any idea how to fix it?
  • febot
    febot over 4 years
    This only applies when the parent is not in the same dir structure, i.e. in a remote repository.
  • Gyro Gearloose
    Gyro Gearloose over 3 years
    Your answer, together with <relativePath/> solved the problem for me. *relativePath alone did not.
  • menoktaokan
    menoktaokan about 3 years
    I removed the stting.xml file and fixed.
  • menoktaokan
    menoktaokan about 3 years
    How did you fix? What did you do, do you remember?
  • menoktaokan
    menoktaokan about 3 years
    Where did you locate the relative? relative between relativePath is not allowed
  • menoktaokan
    menoktaokan about 3 years
    What kind of details? Can you describe?