While I was able to create multiple source directories immediately, I couldn't find a way to specify for each of them an output dir. Even if I have a project with my custom Ant build, NetBeans keeps on building all my classes into a build/classes dir under nbproject.
If anyone can point me to the right direction, this would be great. (tia).
Another thing that seemed to me pretty annoying was that after configuring multiple source directories Netbeans kept asking me the classpath for each source dir. But, I assume this is used for generating a
javac
task in the build.xml.I think what I would really like to read now is some insights on the Netbeans project management and how it is using Ant. Maybe some of you already got this document/link and could share it with me. tia again.
Update: pls read attentively Jesse's comment on this entry. Insights from an "insider" [blink/].
1 comments:
For "plain old Java" projects in NetBeans, where the IDE sets up the project layout for you and generates an Ant build script (which you can customize so long as the basic structure of sources isn't affected), you can as of NB 4.1 have multiple source directories (so long as they all share the same classpath, forming a single compilation unit), but only one output directory and JAR. This feature is mainly intended for fairly simple situations where you really have a single package structure and just want to keep icons and other resources separate from Java sources, for example. As an exception, JUnit-based unit tests may be kept separately, since this is such a common case.
You can have multiple output directories in NB 4.1 (as you could in 4.0), if you use a "freeform" project, i.e. a project based on an existing Ant script. You need to select a different project template in this case, and the user interface is somewhat different - you are telling NB what your project already does, rather than asking the IDE to set it up for you. In the Output tab of the project properties dialog, you can specify some output directories and/or JARs for each source root independently. To do this, you probably want to uncheck Separate Classpath for Each Source Package Folder in Java Sources Classpath, indicating that each source root should be treated as an independent unit. (If you leave this box checked, it behaves more simply - one compilation unit, and all classes assumed to be built together.) If you have interdependencies between source roots, you can express that just as you would in an Ant script which has multiple calls to Ant's javac task: by including the output dir/JAR of one source root in the classpath of another source root. All of this kind of configuration has no effect on how your project is actually built, but it lets the IDE understand the project's structure in detail, so it can offer precise code completion, debugger source stepping, and other features.
Why doesn't the plain prebuilt project type permit multiple output directories (except for compiling unit tests)? Because if you need them, you are probably doing something more subtle than the prebuilt project type is prepared to handle - such as compiling a GUI against a backend model without letting the model refer to the GUI. (This particular case could be handled naturally by setting up two plain projects with an interdependency, but other situations might require specialized build steps or file layouts.) There are a lot of special project setups out there and the IDE can't support all of them directly, though it does have special project types for some common cases with a characteristic structure, like J2EE applications. The freeform project type provides an "escape valve" that lets users who are comfortable with Ant manage quite complex projects in the IDE, even where the IDE doesn't (yet) come with direct support, and integrate a variety of technologies that require more than just classpath additions: code generation, preprocessors and postprocessors, specialized test harnesses, scripting, unusual JVMs, and so on. You can read more:
Using Your Own Ant Script to Compile, Run, and Debug
Advanced Free-Form Project Configuration
Down the road you may see some hybridization between the two project types, if there is enough interest; for example, in NB 4.1 the IDE can generate certain extra Ant targets for you in a freeform project, though without artificial intelligence it can't write a script as nicely as a human programmer.
Re. CVS access types - I'm not sure what you're asking for (and I'm not as knowledgeable about this) but as far as I know you can use any CVS access method from NetBeans. I have CVS working directories set up for use with SourceForge SSH-ext, for example. You will need to have a command-line CVS client for this to work, since the built-in client only understands pserver.
Post a Comment