blob: 098991b7884028a782776b29b4e5bc1bcd980eba [file] [log] [blame]
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
= How do I have two source directories within one module?
:page-layout: wikidev
:page-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaq2SrcPaths
:description: Apache NetBeans wiki DevFaq2SrcPaths
:toc: left
:toc-title:
:page-syntax: true
:page-wikidevsection: _development_issues_module_basics_and_classpath_issues_and_information_about_rcpplatform_application_configuration
:page-position: 3
Adding an extra source directories is possible in case you need to create a separate output JARs (besides the module itself), generally with its own special classpath.
In your module's `project.xml`, add a declaration of the source root just before `</data>`:
[source,xml]
----
<extra-compilation-unit>
<package-root>othersrc</package-root>
<classpath>...anything it might need to compile against...</classpath>
<built-to>build/otherclasses</built-to>
<built-to>${cluster}/modules/ext/other.jar</built-to>
</extra-compilation-unit>
----
This declaration has no effect on the build, but lets you work with the sources in the IDE's code editor.
You will separately need to add a target to your `build.xml` to compile and package these sources however you like.
(You can name your target `netbeans-extra` and it will get run automatically toward the end of the module's build cycle.)
If you define properties like a special classpath in `project.properties`,
you can use the values in both `build.xml` and `project.xml` to minimize duplication.
You can also create a plain Java SE project in a subdirectory of your module
and bundle its JAR. xref:./DevFaqWrapperModules.adoc[DevFaqWrapperModules] describes a related technique.
Read the `harness/README` file under your Netbeans installation directory
for information about issues like this one.
The build harness has many capabilities not exposed through the GUI.
Applies to: NetBeans IDE 6.x
Platforms: All