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.
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...
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.
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).
(In reply to comment #2) > To clarify, ~/pom.xml existed so everything under ~/.m2/repository/ was > considered owned by it? Yes, exactly.
i'm not entirely sure that it involves just the display names, IMHO all features using inter-project dependencies could be affected.
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?
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; } to 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.
Created attachment 119613 [details] suggested patch
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..
Thanks for review, I will integrate shortly..
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.
(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.
(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...
http://hg.netbeans.org/core-main/rev/ed91153616b1 for api part and http://hg.netbeans.org/core-main/rev/5f78cecab198 for maven part.
Integrated into 'main-golden', will be available in build *201206010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/ed91153616b1 User: Milos Kleint <mkleint@netbeans.org> 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.