4

I ask the question more specific:

Using Netbeans, is there a possibility to create an additional custom build target, which would:

  • either package all project sources along with the binaries into a singe JAR,
  • or package all project sources without the binaries into an additional JAR?

Notes:

  • It's not an option for me to modify the text field "Exclude from JAR file:" in the project properties, because it wouldn't provide me with an additional build target ;)
  • As you can guess, it's for an open source project ;)
ivan_ivanovich_ivanoff
  • 19,113
  • 27
  • 81
  • 100

3 Answers3

5

Thank to Mark's resource hint, I reduces the example to minimum complexity:

Following is done to pack only the sources:

<!-- depends="jar" have to stay:
    without it, we haven't the variable ${application.title} -->
<target name="MY-EXPORT-SOURCES" depends="jar">
    <echo>MY TARGET: PACKAGING ${application.title} SOURCES</echo>
    <delete file="dist/${application.title}.SOURCES.zip"/>
    <zip destfile="dist/${application.title}.SOURCES.zip" basedir="src"
        includes="**/*.java"/>
</target>

To run in Netbeans, do:
build.xml rightclick -> run targets -> other targets -> MY-EXPORT-SOURCES.

Community
  • 1
  • 1
ivan_ivanovich_ivanoff
  • 19,113
  • 27
  • 81
  • 100
3

Check this out:

http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/

Might be the trick, just change the targets names to be more appropriate for your use

Mark
  • 14,820
  • 17
  • 99
  • 159
2

Yes Sure,

In Netbeans Project...

Right Click on Project and then select Properties.

In Properties window...

Go -> Build -> Packaging...

Remove -> */.java,

in Exclude From war file...

thats it...

Let me know, if it helps you...

Razi
  • 21
  • 1