// 
//     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.
//

= DevFaq2SrcPaths
:jbake-type: wiki
:jbake-tags: wiki, devfaq, needsreview
:jbake-status: published
:keywords: Apache NetBeans wiki DevFaq2SrcPaths
:description: Apache NetBeans wiki DevFaq2SrcPaths
:toc: left
:toc-title:
:syntax: true

=== How do I have two source directories within one module?

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. link:DevFaqWrapperModules.asciidoc[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

=== Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the
Apache Software Foundation.

This page was exported from link:http://wiki.netbeans.org/DevFaq2SrcPaths[http://wiki.netbeans.org/DevFaq2SrcPaths] , 
that was last modified by NetBeans user Admin 
on 2009-11-06T15:33:06Z.


*NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.
