Issue
I have a Maven project that has always worked fine in Netbeans, but upgrading from 6.9 to 7.1 did not go well. I get the following error:
1 problem was encountered while building the effective model for foo.bar:baz:1.0.0 [FATAL] Non-resolvable parent POM: The repository system is offline but the artifact foo:bar-parent:pom:1.0.1 is not available in the local repository. and 'parent.relativePath' points at wrong local POM @ line 12, column 13 for project foo.bar:baz:1.0.0 at /Users/me/workspace/pom.xml
I found this bug ticket for Netbeans that pretty well describes the issue for another guy but the suggestion of using "Reload POM" doesn't work, nor does mvn validate
.
There are several confusing items here.
- Running on commandline works.
- My co-worker, with identical (by all indications) setup, runs this project on NB 7.1.
- Building inside Netbeans works (the build succeeds)
- Using the provided "Prime Build" button on the error dialog starts a build that succeeds.
- The file is not missing! It is (and has been) in the local repo! Exactly where I'd expect it: .m2/repository/foo/bar-parent/1.0.1/bar-parent-1.0.1.pom
According to the Maven POM intro page, the relativePath attribute is to be used when you have a parent pom/project located in a different-than-normal location (where "normal" is "../pom.xml").
In my case, my parent project is actually just a pom, and it doesn't live anywhere except in the repository (locally and remotely). Even if it didn't exist locally, I'd expect doing a secondary "online" build (as suggested) would fix Netbeans, but it doesn't.
At one point I manually changed my pom file outside of Netbeans, and the project inside NB fixed itself. I manually modified the subprojects the same way to get them to work but the fix didn't last. A few minutes later the "[unloadable]" moniker returned, though I don't know exactly when or what caused it to return.
I've tried using the Bundled v3.0.3 Maven, my external v3.0.2 Maven, deleting my ~/.netbeans*
folders, deleting my .m2/repository
folder, copying his .m2/repository
to my machine, deleting all versions of Netbeans and reinstalling 7.1, closing and reopening the projects and the app, letting Netbeans build the project from scratch using both the normal Build
, Clean and Build
options as well as the Prime Build
option on the error dialog, doing the build from scratch on the commandline then importing to Netbeans, any and all combinations thereof, and nothing seems to matter.
For now I'm downgrading to 6.9.1, but I would love to know if there's something else I can try to make this work.
Solution
Update: I've set my settings.xml too... :(
<mirrors>
<mirror>
<id>javaforum</id>
<url>http://nexus.javaforum.hu/nexus/content/groups/public/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>javaforum</id>
<url>http://nexus.javaforum.hu/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
It works now with NetBeans 7.x.
If I remove/comment the "repository" section:
* CLI (3.0.3) build is working
* NetBeans 7.x build is working but the project is "unloadable"
If I remove/comment the "mirror" section:
* CLI (3.0-3) build isn't working
* NetBeans 7.x build is working, the project looks like good
So, the pom.xml modification is not necessary IMHO... :)
Answered By - Gábor AUTH
Answer Checked By - David Marino (JavaFixing Volunteer)