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 198162 - ${basedir}/target/pom.xml causes ${basedir}/target/ to be treated as a nested project
Summary: ${basedir}/target/pom.xml causes ${basedir}/target/ to be treated as a nested...
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-28 06:12 UTC by vicaya
Modified: 2011-05-05 05:58 UTC (History)
0 users

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 vicaya 2011-04-28 06:12:49 UTC
To reproduce the defect in a maven project with generated sources: copy a pom.xml to the target (${project.build.directory}) directory, close the project and reopen the project, the generated sources are no longer recognized in the IDE (showing an empty <default package>.), which is problematic

The cause of the problem seems to be org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation#getOwner not checking if the potential project directory is a build directory as indicated by the messages.log (showing the owner project to be the target/pom.xml) with option -J-Dorg.netbeans.api.project.level=FINE 

Took me a while to track down the problem as it only manifests after reopening the project, when I decide to try out NetBeans 7.0. Turns out 6.9.1 has the same problem as well.
Comment 1 vicaya 2011-04-28 16:16:39 UTC
I triggered the bug by generating a sanitized pom.xml (to work around MNG-4223) in the target directory. The work-around is to rename the pom.xml in target directory to saner-pom.xml. But this is a bug that needs to be fixed nonetheless, as it's extremely mystifying and hard to track down when suddenly generated sources are not recognized after I restart the IDE, which is sometime (in my case 3 work days and 1 week of vacation) later.
Comment 2 Jesse Glick 2011-05-04 14:27:34 UTC
Right, using target/saner-pom.xml would be the workaround. A fully general check in the ProjectFactory that pom.xml is not contained anywhere within some other project's build output would probably be too expensive, but could introduce some special handling for this case (pom.xml under dir named 'target' and parent dir also contains pom.xml) under the assumption it is especially common and especially problematic.
Comment 3 Jesse Glick 2011-05-04 14:44:14 UTC
core-main #88566972cc2d
Comment 4 Quality Engineering 2011-05-05 05:58:54 UTC
Integrated into 'main-golden', will be available in build *201105050000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/88566972cc2d
User: Jesse Glick <jglick@netbeans.org>
Log: #198162: ${basedir}/target/pom.xml causes ${basedir}/target/ to be treated as a nested project