Re: Compiling with multiple sources on NB 4.0

Jesse Glick <[email protected]>
Newsgroups gmane.comp.java.netbeans.user-interface
Organization Sun Microsystems
Message-ID <[email protected]>
Mark McKay wrote:
>> One of the things I'm doing is using four different directories to
>> store my source in.  The reason for this is that there are
>> multiple stages in my build process, some of which will cause code
>> to be auto generated.  Some classes need to be [compiled] before
>> this auto code is generated, while others depend on the auto
>> generated code and must be compiled later.

This should be fine, but you probably do not want to declare the 
generated dirs as source roots since it will slow things down; you can 
include the result of building them (a JAR) in the classpath of real 
source roots. Expect a classpath rescan dialog to appear when you 
rebuild one of these JARs - should however be brief, disappearing after 
a second or so.

You could declare the generated dirs as source roots if you needed 
either (1) to step into these sources during debugging, (2) to get popup 
Javadoc included in the code completion available on other sources 
referring to generated sources, beyond method names and parameter types. 
In that case you will still need to include the build output of the 
generated classes in the declared classpath of the dependent source 
root(s), as well as to tell the IDE where the output is (in the Outputs 
panel of the properties dialog).

>> Unfortunatley, NB 4.0 seems to assume that only one source tree is
>> used for things like compiling, running or debugging a single
>> file. I've been able to implement all three of these things for
>> freeform projects with a single source root, but not with multiple
>> roots.

This is not true. Each <action> in <ide-actions> can apply only to a 
single source root. However you may have multiple <action>s with the 
same 'name', provided they have different <folder>s in their <context>s. 
Each variant of the action will be consulted in turn until a match is 
found. In this way you can e.g. bind Compile File to different Ant 
targets for each source root in your project (or, if you like, to the 
same Ant target but with different properties defined).

Vincent Brabant wrote:
> Maybe it's better to swithc to Netbeans 4.1, even if it's only the
> EA2. Reason is that NetBeans 4.1 supports multiple sources
> directories.

NB 4.0 supports multiple source directories in freeform projects, so 
this is no reason to switch to 4.1.

-J.

-- 
Jesse Glick <mailto:[email protected]> x22801
NetBeans, Open APIs  <http://www.netbeans.org/>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.