Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unloadable Netbeans projects (pom not available in the local repository)

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.

like image 676
inanutshellus Avatar asked Jan 25 '12 15:01

inanutshellus


1 Answers

What is the header of your pom.xml? I've changed it to this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

from

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

Maven CLI builds both of them, NetBeans 6.x too... but NetBeans 7.x builds only the first one.

like image 164
Gábor AUTH Avatar answered Jan 03 '23 06:01

Gábor AUTH