This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 198550 - Impossible to resolve local maven dependency
Summary: Impossible to resolve local maven dependency
Status: RESOLVED INCOMPLETE
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: PC Linux
: P1 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
: 198532 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-05-12 11:04 UTC by Nocia
Modified: 2011-05-27 13:05 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nocia 2011-05-12 11:04:44 UTC
NetBeans 7.0 with maven 2.2.1 is not able to find a maven projects situated in a parent directory.

The directories structure is the following:

-CodeBase
 -- Module A
 -- Module B
 -- Module Shared Lib
 -- Module C
  -- Module C.A
  -- Module C.B

In this structure, the Module A and B can find the Module "Shared Lib". However the modules C.A and C.B can't find the "Shared Lib" dependency.

The POM of the CodeBase defines the module A, B, Shared Lib and C.
The POM of the Module C defines the module C.A and C.B.
In the artifacts of the modules C.A and C.B are declared as dependencies the necessary artifacts of the module "Share Lib"

This project compiles and runs perfectly, but NetBeans can't resolve these dependencies that leads to unrecognized classes (classes red underlined and no completion available).

This configuration was perfectly working with the previous version of NetBeans as the 6.9.1 one. Thus, I think this is a regression.

Due to this problem I just can't use NetBeans 7.0 and continue to develop with the previous version.

Thanks in advance for your help
Comment 1 Nocia 2011-05-12 11:16:42 UTC
*** Bug 198532 has been marked as a duplicate of this bug. ***
Comment 2 fpoulin 2011-05-16 11:07:32 UTC
That's definitely a blocker for me before switching to Netbans 7.
Comment 3 s_zeith 2011-05-16 15:31:11 UTC
Hello,
same problem here. Pretty annoying when you're working with a big project (with lot of dependencies).
That would be nice if at some point this issue was fixed.
Looked for some work around and haven't found any (as Netbeans 7.0 is pretty new, don't know if this issue was encountered by some of the tester during the beta?) so for now I'm back to version 6.9.1.
Cheers.
Comment 4 Jesse Glick 2011-05-16 21:55:17 UTC
Most likely an error in the user's projects; first read through https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html to check for well-known issues that users might encounter when moving from M2 to M3. In order to evaluate such issues I need to have a complete, self-contained test case that can be reproduced using posted instructions.
Comment 5 Nocia 2011-05-17 07:11:37 UTC
(In reply to comment #4)
> Most likely an error in the user's projects; first read through
> https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html to check for
> well-known issues that users might encounter when moving from M2 to M3. In
> order to evaluate such issues I need to have a complete, self-contained test
> case that can be reproduced using posted instructions.

In fact I still use maven 2 (2.2.1) to avoid this problem. Do you want that I add a dummy project with this problem?
Comment 6 jonesbusy 2011-05-19 14:39:58 UTC
Same problem, please fix.
Comment 7 Nocia 2011-05-22 09:57:15 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Most likely an error in the user's projects; first read through
> > https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html to check for
> > well-known issues that users might encounter when moving from M2 to M3. In
> > order to evaluate such issues I need to have a complete, self-contained test
> > case that can be reproduced using posted instructions.
> 
> In fact I still use maven 2 (2.2.1) to avoid this problem. Do you want that I
> add a dummy project with this problem?

I mean I don't use maven 3 to avoid compatibilities problem. But with maven 2.2.1 NetBeans 7 can't resolve parent dependencies (but the project compile thus this is a NetBeans bug).
Comment 8 Jesse Glick 2011-05-23 19:24:00 UTC
(In reply to comment #6)
> Same problem, please fix.

Again, I need a test case to reproduce any problem.

(In reply to comment #7)
> I don't use maven 3 to avoid compatibilities problem.

NetBeans 7 embeds Maven 3, so a project which cannot be built using Maven 3 may not be correctly loaded by the IDE either. (Selecting a Maven installation in the Options dialog only affects builds as shown in the Output Window; it has no effect on the embedder.)
Comment 9 etf 2011-05-26 14:06:08 UTC
It's an show stopper for me. Why it is closed?
Comment 10 Jesse Glick 2011-05-26 15:48:45 UTC
Again, because there is no information to reproduce the problem and thus evaluate it. http://www.chiark.greenend.org.uk/~sgtatham/bugs.html has a nice summary. Ideally I would want to see a ZIP file containing a complete multimodule project source tree (no target/ dirs!) which builds correctly using Maven 3 on a virgin computer (or with any necessary setup prerequisites listed in detail), but persistently displays error badges (or whatever the problem is) when opened in NetBeans.

Output from the "NetBeans Metadata Project Inspector" module (available from the update center) may be helpful but is not a substitute for a test case.
Comment 11 etf 2011-05-26 15:55:04 UTC
It looks like I found a workaround. Unfortunately I'm busy with other assignment now, bot I'll get back soon.
Comment 12 etf 2011-05-27 09:11:10 UTC
[WORKAROUND]

This issue is environment specific and it is a big dial to reproduce it. NetBeans fails with project which has parent POM project. This parent project must not be installed locally. It must be located some where in remote repository. In this case, when maven downloads it and put is into local repository the corresponding file maven-metadata-local.xml is still unchanged. This is, I believe, a root cause of the issue.  
I have fixed this issue in my environment in following way. I have 3 nested parent projects. I have downloaded them all from the remote repository and install locally with following command:

mvn install:install-file -Dfile=war-parent-1.0.0.pom -DpomFile=war-parent-1.0.0.pom

Please reopen this issue. It is quite critical for big projects.
Comment 13 Jesse Glick 2011-05-27 12:07:07 UTC
(In reply to comment #12)
> NetBeans fails with project which has parent POM project. This parent project
> must not be installed locally. It must be located some where in remote
> repository. In this case, when maven downloads it and put is into local
> repository the corresponding file maven-metadata-local.xml is still unchanged.
> This is, I believe, a root cause of the issue.  

When I delete ~/.m2/repository/ and open a checkout of https://svn.codehaus.org/mojo/trunk/mojo/nbm-maven-plugin it works - the IDE says "Reloading online", and downloads necessary artifacts in the background and then reloads the project. ~/.m2/repository/org/codehaus/mojo/mojo-parent/28/mojo-parent-28.pom has been downloaded as expected after this is done. There is no maven-metadata-local.xml but it does not seem to matter.

> I have 3 nested
> parent projects. I have downloaded them all from the remote repository and
> install locally with following command:
> 
> mvn install:install-file

That will certainly work, but it should not be necessary - the IDE will attempt to download all parent POMs when opening the project, and if that fails you can simply run a build of the child project (the 'validate' phase suffices). If command-line Maven (e.g. F11 from the IDE) does not retrieve your parent POMs then you have some kind of misconfiguration in your projects and/or environment.

By the way, this does not sound like the same problem as Nocia's ("projects situated in a parent directory"), though without information to reproduce any of them it is hard to be sure.
Comment 14 etf 2011-05-27 12:53:46 UTC
Yes mvn downloads all dependencies, but NetBeans still says "can't resolve ... ".
Comment 15 Jesse Glick 2011-05-27 13:05:11 UTC
(In reply to comment #14)
> mvn downloads all dependencies, but NetBeans still says "can't resolve ..."

So some sort of issue with embedder configuration seems likeliest; bug #167208 is my only guess among issues already reported.