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

Posted on 2009-02-19
Last Modified: 2013-11-10
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="" >

           <fileset dir="${}"/>           

           <fileset dir="${logbook.dir.conf}/lib" />

           <fileset dir="${logbook.dir.conf}/conf"/>         


Open in new window

Question by:pradumb29
    1 Comment
    LVL 2

    Accepted 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

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Suggested Solutions

    In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now