How to include a folder in a JAR distribution as part of the build process using Netbeans?

I am using Netbeans 6.9 and I have studied editing the build.xml file so that I can include directories and files in the jar file as a result of creating the project.

So my question is: How do I change the build.xml file to host other folders in the bank?

I have the following directory structure for my project

ProjectDir/
/images/
/src/com/...
/lib/
and so on..

And I want the jar file built with ant build script to look like

project.jar
/com
/lib - this should include jar files inside the lib folder
/images - this should include jpg files
/META-INF

I need to do this because I am β€œinstalling” the jar file in Adobe Livecycle as a custom component, and all jb library files and images must be included in the jar.

Also, if there is a way to do this without using the build.xml file, which would be nice too, at the moment I'm just copying the folders / files to the jar file.

+4
source share
2 answers

http://ant.apache.org/manual/Tasks/copydir.html

  <copydir src="${base.path}/lib/" dest="${build.path}/lib" /> <copydir src="${base.path}/images/" dest="${build.path}/images" /> <copydir src="${base.path}/src/com/" dest="${build.path}/com" /> <copydir src="${base.path}/META-INF/" dest="${build.path}/META-INF" /> 

http://ant.apache.org/manual/Tasks/jar.html

 <jar destfile="project.jar" basedir="${build.path}" includes="**/*.*" /> 
+3
source

If someone sees this, now copydir is deprecated, use:

 <target name="-post-compile"> <copy todir="${dist.dir}/ace"> <fileset dir="src/ace"/> </copy> </target> 
+2
source

All Articles