After migrating to Mavent 3.0.3 Parent poms in several Projects cannot be resolved anymore.
The Projects are structured in a default manner, so I set parent.relativePath to "../pom.xml"
superpom (located in repository)
|-rootpom (located locally: no error)
|-|-parentpom (located locally: error resolving parent)
|-|-|-module1 (located locally: error resolving parent)
|-|-|-module2 (located locally: error resolving parent)
|-|-|-module3 (located locally: error resolving parent)
|-|-|-module4 (located locally: error resolving parent)
The Error...
Non-resolvable parent POM for myGroup:myArtifactId:1.0: Failure to find myGroup:myParentArtifactId:1.0 in http://myRepo.net/archiva/repository/maven2 was cached in the local repository, resollution will not be reattempted until the update interval of maven2 has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ myGroup:myParentArtifactId:1.0, C:\myProjectDir\parent\pom.xml, line x, column y -> [Help 2]
... seems to indicate that the pom was searched for in the repository, so I wonder why the pom was not found locally before looked elsewere.
I have read that maven3 might get confused when several repositories are defined in the settings.xml, but that was always when searching for a pom inside repositories and not locally.
update
Up until now we did execute the maven build on the parent-project level (parentpom) - a fact wich I did not know was important, since maven2 completed successfully until now.
When using maven3 this seems to be of importance. When executing maven3 on the root-project level (rootpom) the build finishes successfully. So my immediate problem is solved.
Since I don't neccessarily want to answer my own question maybe someone can explain why maven3 behaves this way now or why the old approach was wrong.
Here is answer to your question.
By default maven looks in
../pom.xml
forrelativePath
. Use empty<relativePath/>
tag instead.Add following line in parent
You need relative path if you are building from local parent pom not available in nexsus, add pom in nexus then no need this path
I had the same problem. My project layout looked like
In my case, I had a mistake in my pom.xmls at the modX-root-level. I had copied the mod1-root tree and named it mod2-root. I incorrectly thought I had updated all the pom.xmls appropriately; but in fact, mod2-root/pom.xml had the same group and artifact ids as mod1-root/pom.xml. After correcting mod2-root's pom.xml to have mod2-root specific maven coordinates my issue was resolved.
You need to check your relative path, based on depth of your modules from parent if module is just below parent then in module put relative path as: ../pom.xml
if its 2 level down then ../../pom.xml
Make sure you Double-Check that the version you refer to in the child-pom is the same as that in the parent-pom. For me, I'd bumped version in the parent and had it as 3.1.0.0-RELEASE, but in the child-pom, I was still referring to the previous version via relativePath, and had it defined as 2.0.0.0-SNAPSHOT. It did not make any difference if I included just the parent directory, or had the "pom.xml" appended to the directory:
This indicates that maven did search locally for the parent pom, but found that it was not the correct pom.
pom.xml
ofparentpom
correctly define theparent
pom as thepom.xml
ofrootpom
?rootpom
folder containpom.xml
as well as theparetpom
folder?