Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 931
  • Last Modified:

ant build ,, need a folder structure in the jar file

i want to make my build script to make a jar which has a folder structure something like
- lib(contains all the lib files)
-conf(contains all the xml files..)
-resource(contains all the resource files)
-class files..
the problem that i am facing is the while creating the jar file i am using fileset dir and the out put is
-class files
-files (without package structure.....)
I have attached the code along with it..
can anyone help me with it...!!! what should i do in order to get the files in folders..
Thanks ,,,
<jar destfile="${logbook.dist.dir}/${adapter}.jar" filesonly="false" manifest="Manifest.mf" >
           <fileset dir="${logbook.dir.build}"/>           
           <fileset dir="${logbook.dir.conf}/lib" />
           <fileset dir="${logbook.dir.conf}/conf"/>         

Open in new window

1 Solution
when you want a folder structure as you explained above, you can follow these steps,-

1. One you are done with the build, organize all your compiled classes, jsp pages, configuration files in a parent folder called "build". Create folders inside "build" and move related files there. e.g. move configuration files to conf folder etc.
2. To accomplish above step, you can use ANT commands to move files from one folder to another.
2. Run the jar command  as shown in the code snippet.

Hope it helps!

 <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/MyProject-${DSTAMP}.jar" basedir="${build}"/>

Open in new window


Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now