Maven: Non-resolvable parent POM
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>
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 ..
It can also be fixed by putting the correct settings.xml
file into the ~/.m2/
directory.
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.