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 212015 - All maven project dependencies have the same display name
Summary: All maven project dependencies have the same display name
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Milos Kleint
Depends on:
Reported: 2012-05-03 13:03 UTC by Martin Fousek
Modified: 2012-06-01 05:26 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

screenshot of dependencies (206.59 KB, image/png)
2012-05-03 13:03 UTC, Martin Fousek
suggested patch (7.01 KB, application/octet-stream)
2012-05-18 12:36 UTC, Milos Kleint

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Fousek 2012-05-03 13:03:14 UTC
Created attachment 119030 [details]
screenshot of dependencies

Product Version: NetBeans IDE Dev (Build 20120503-218a03f9b127)
Java: 1.6.0_26; Java HotSpot(TM) 64-Bit Server VM 20.1-b02
System: Linux version 3.0.0-12-generic running on amd64; UTF-8; en_US (nb)

As you Milos figured out in my environment, when I had pom.xml file inside the linux user home, all dependencies of the project looked like one the same project (Guestbook). :) See the attached screenshot that the situation could look really awful although I know it could be my fault to have placed pom.xml file so badly.

Feel free to close it when there wouldn't be proper way how to fix this. Thanks a lot...
Comment 1 Milos Kleint 2012-05-03 13:09:08 UTC
ideally we would be able to limit FileOwner Query inside the local maven repository.. only the file itself should be checked for ownership and none of it's parents.
Comment 2 Jesse Glick 2012-05-03 18:30:57 UTC
To clarify, ~/pom.xml existed so everything under ~/.m2/repository/ was considered owned by it?

I think it would suffice for DependencyNode.getDependencyProjectAvailable to directly call MavenFileOwnerQueryImpl.getInstance().getOwner(uri) rather than FileOwnerQuery.getOwner(uri).
Comment 3 Martin Fousek 2012-05-04 05:52:48 UTC
(In reply to comment #2)
> To clarify, ~/pom.xml existed so everything under ~/.m2/repository/ was
> considered owned by it?

Yes, exactly.
Comment 4 Milos Kleint 2012-05-04 05:59:15 UTC
i'm not entirely sure that it involves just the display names, IMHO all features using inter-project dependencies could be affected.
Comment 5 Milos Kleint 2012-05-04 07:54:38 UTC
tzezula: would an exclude root for  SimpleFileOwnerQueryImpl solve the problem? eg. we would from maven codebase set the maven's local repository root as excluded and SFOQI would not iterate parents when inside the excluded directory? would that work? would the performance penalty of always checking for exclude roots be too high?
Comment 6 Jesse Glick 2012-05-04 14:20:01 UTC
I do not think there would be any performance penalty; SFOQI already checks for external owners in a very similar manner. FOQ.markExternalOwner does accept owner=null but that means "unmark" rather than "mark as unowned and stop searching".

My API_REVIEW_FAST suggestion: add to FOQ

 * Pseudoproject indicating just that a directory is definitely unowned.
 * May be returned by either {@code getOwner} overload of
 * {@link FileOwnerQueryImplementation}, in which case null is returned from
 * either {@code getOwner} overload here. May also be passed to either
 * {@code markExternalOwner} overload, in which case the standard directory
 * search will be pruned at this point with no result.
 * @since XXX
public static final Project UNOWNED = new Project() {
  @Override public FileObject getProjectDirectory() {
    return FileUtil.createMemoryFileSystem().getRoot();
  @Override public Lookup getLookup() {
    return Lookup.EMPTY;

Then impl should be simple: change (2x)

if (p != null) {
  return p;


if (p != null) {
  return p == UNOWNED ? null : p;

SFOQI.markExternalOwnerTransient would also need to check for UNOWNED and use a special marker URI like "urn:unowned", and deserialize would need some tweaking (or you could simply not bother serializing UNOWNED).

The maven module would then call FOQ.mEO(localRepo.toURI(), UNOWNED, EXTERNAL_ALGORITHM_TRANSIENT) once per session, say in the static initializer of NbMavenProjectImpl (or whenever the MavenEmbedder is definitely about to be loaded anyway). It might need to call it again in case the localRepository location in Settings changes.
Comment 7 Milos Kleint 2012-05-18 12:36:39 UTC
Created attachment 119613 [details]
suggested patch
Comment 8 Milos Kleint 2012-05-18 12:40:07 UTC
please review the following change. We introduce an UNOWNED contant project used by SFOQ to stop traversing to the root folder while searching for project. Includes a usage of the API in the maven codebase, where local repository root is marked to return no owner and not to traverse to parents. Guarding us from accidental pom.xml in user's home directory..
Comment 9 Milos Kleint 2012-05-28 07:11:44 UTC
Thanks for review, I will integrate shortly..
Comment 10 Jesse Glick 2012-05-29 12:22:23 UTC
For stylistic reasons URI.create("http:unowned") should probably be URI.create("urn:unowned") or similar.

BTW the API usage in the maven module is not shown in this patch.
Comment 11 Milos Kleint 2012-05-29 12:34:11 UTC
(In reply to comment #10)
> For stylistic reasons URI.create("http:unowned") should probably be
> URI.create("urn:unowned") or similar.

there is no handler for urn: and I was getting errors from the tests and IDE.

> BTW the API usage in the maven module is not shown in this patch.

:( that means it's lost and I will have to do it again.
The general idea in omn the maven side was to remember the last local repository path in MavenEmbedder.getSettings() and unset the old location and set the new one.
Comment 12 Jesse Glick 2012-05-29 22:06:10 UTC
(In reply to comment #11)
> there is no handler for urn:

Ah, someone was creating a URL you mean.

> it's lost

Check local history...
Comment 13 Milos Kleint 2012-05-30 12:15:41 UTC for api part
and for maven part.
Comment 14 Quality Engineering 2012-06-01 05:26:47 UTC
Integrated into 'main-golden', will be available in build *201206010001* on (upload may still be in progress)
User: Milos Kleint <>
Log: #212015 add UNOWNED Project constant for use in FOQ implementations and in markExternalOwner calls. Will be used by maven support to mark the root of local repository to prevent climbing out of the local repo and getting owned by a project.