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 171206 - Classes in alternate source tree are not visible to other modules
Summary: Classes in alternate source tree are not visible to other modules
Status: RESOLVED INVALID
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker with 1 vote (vote)
Assignee: rmichalsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-31 20:01 UTC by tomwheeler
Modified: 2009-09-10 02:22 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Example suite to illustrate the described problem (3.21 MB, application/x-compressed)
2009-08-31 20:04 UTC, tomwheeler
Details
Fix of your problem (6.13 KB, patch)
2009-09-10 01:56 UTC, Jesse Glick
Details | Diff
One more correction necessary for Go to Source to work from consumer/src -> producer/build/gensrc (625 bytes, patch)
2009-09-10 02:22 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tomwheeler 2009-08-31 20:01:55 UTC
One of my projects uses JAXB to generate some classes from an XML schema file.  As is conventional for generated
classes, I have them created in an alternate source tree (e.g. gen-src instead of src).  This allows the build artifacts
to be excluded from source control and also avoids the possibility of overwriting non-generated source code. 

I was able to generate and compile the sources, but found that even after exporting this package and adding a dependency
from another module, the other module is unable to see any of the generated classes.  I have created a simple suite with
two modules that should illustrate the problem.  I will upload it shortly.
Comment 1 tomwheeler 2009-08-31 20:04:19 UTC
Created attachment 86880 [details]
Example suite to illustrate the described problem
Comment 2 tomwheeler 2009-08-31 20:25:46 UTC
Instructions for the example suite:

1.  Unpack and open the suite in the NetBeans IDE.  I created it in 6.5, but I originally experienced the problem in 6.7
and expect that it could affect other versions as well.

2.  Clean and build the suite.

3.  Open the com.tomwheeler.example.consumer.Sample class in the Consumer module.  

4.  Note that the 'Consumer' module declares a dependency on the 'Producer' module.  Thus, it is able to see the
com.tomwheeler.example.producer.exported.Dummy class as expected (the Dummy class in the src/ directory of the Producer
module).

5.  Uncomment the reference to 'Items' (com.tomwheeler.example.producer.exported.Items) on line 12.  Even though this is
in the same package as 'Dummy' you cannot use it or even import it without a build error.  As noted in the comments, the
Items class file is in the Producer module's  build/classes directory, JAR in the suite's cluster directory and JAR in
the suite's public packages directory.  

6.  Click the Files tab, expand the Producer module, then expand the gen-src/com/tomwheeler/example/producer/exported
directory.  Copy the java files in this directory and paste them into the corresponding directory in the normal source
tree (src/com/tomwheeler/example/producer/exported).  

7.  After rebuilding the suite, you will be able to use the generated source code (e.g. the reference to Items) in the
Sample class whereas you couldn't do this in step 5.  
Comment 3 Jesse Glick 2009-09-10 01:56:55 UTC
Created attachment 87398 [details]
Fix of your problem
Comment 4 Jesse Glick 2009-09-10 02:03:08 UTC
Separate source roots need to be built into separate JARs so they can be identified as such.
Comment 5 Jesse Glick 2009-09-10 02:22:24 UTC
Created attachment 87399 [details]
One more correction necessary for Go to Source to work from consumer/src -> producer/build/gensrc