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

6

5

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.

Seek answered 25/1, 2012 at 15:40 Comment(0)
M
2

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... :)

Moriarty answered 28/2, 2012 at 17:34 Comment(1)
I purged my repository and stole another developer's settings.xml and the issue cleared itself up. The settings.xml wasn't enough, though, for some reason. Re-instating my old repository to save bandwidth (it's a gig in size) caused the problem to return! Thanks for the help Gábor!Seek
M
4

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.

Moriarty answered 13/2, 2012 at 11:8 Comment(1)
Mine already matches your new version. Thanks for posting on an older question... I'm still out here listening (and still on 6.9.1)!Seek
M
2

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... :)

Moriarty answered 28/2, 2012 at 17:34 Comment(1)
I purged my repository and stole another developer's settings.xml and the issue cleared itself up. The settings.xml wasn't enough, though, for some reason. Re-instating my old repository to save bandwidth (it's a gig in size) caused the problem to return! Thanks for the help Gábor!Seek
G
2

I wound up having to copy the pom.xml file from my repo to one directory level above my project's pom.xml and renaming to pom.xml. Not ideal but it worked.

Galosh answered 10/4, 2012 at 17:18 Comment(0)
T
2

I saw the described error when running NetBeans 7.1.x after an attempt to clean up my internal repository (Archiva, using repo groups), simplify my settings.xml and then adding a parent POM to my project.

If I remove the parent POM reference in my project, the issue goes away.

If I include an active profile in my settings.xml with a valid repository section, the issue goes away.

If I include a valid repositories section in my project POM, the issue goes away.

My parent POM is not the root of a multi-module project. It is merely pulled from the repository like any other dependency. I don't have a multi-module project with a parent that I can try it with.

Regardless, maven builds and deploys my projects just fine from the command-line without that setting (even with a parent POM), but NetBeans itself seems to need a repositories section defined somewhere.

Seems to me to be a bug with how Netbeans treats child projects. My guess is that it is looking in the default location location for the parent (../pom.xml) and when it can't find it, tries to look for it in the defined repositories. Since it isn't define, it chokes.

Netbeans seems to ignore the mirrors setting when trying to find the parent POM.

Tebet answered 18/4, 2012 at 21:11 Comment(0)
J
0

I changed parent version to 2.6.4 from 2.6.5

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.6.4</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
Jew answered 26/3, 2022 at 20:13 Comment(0)
A
0

In my case, relativePath was not defined for child projects and it seems that Netbeans 14 itself wasn't able to defer the default value. Running Maven itself was successful, but the projects were shown as "Unloadable" in Netbeans - I had to hardcode the default value of relativePath for the projects to get loaded correctly by Netbeans (<relativePath></relativePath> also works - but as others have pointed out, it is supposed to effectively disable the relative lookup of the parent POM, trying to resolve it through the local Maven repository):

   <parent>
      <groupId>org.example</groupId>
      <artifactId>example</artifactId>
      <version>1.0-SNAPSHOT</version>
      <relativePath>../pom.xml</relativePath>
   </parent>
Amanita answered 20/2, 2023 at 10:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.