Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8530895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:21:36+00:00 2026-06-11T09:21:36+00:00

I am creating a jar bundle using ant build script. The problem is that

  • 0

I am creating a jar bundle using ant build script. The problem is that the .class files are not included in the generated .jar file. I have also tried the {build.dest} in making the jar, but with no effect.

remaining all the files i require are in .jar file.

Here is my build script

<?xml version="1.0"?>

<project name="TaskNodeBundle" default="all" basedir=".">
    <!-- Sets variables which can later be used. -->
    <!-- The value of a property is accessed via ${} -->
    <property name="bundlename" value="task-node-bundle" />
    <property name="src.dir" location="../src" />
    <property name="lib.dir" location="../lib" />
    <property name="build.dir" location="/buildoutput" />
    <property name="build.dest" location="../build/dest" />


    <!--
        Create a classpath container which can be later used in the ant task
    -->
    <path id="classpath">
        <fileset dir="${lib.dir}/">
            <include name="*.jar" />
        </fileset>
    </path>

    <target name="clean">
        <delete dir="${build.dir}" />
        <delete dir="${build.dest}" />
    </target>

    <!-- Deletes the existing build directory -->
    <target name="mkdir" depends="clean">
        <mkdir dir="${build.dest}"/>
    </target>


    <!-- Compiles the java code -->
    <target name="compile" depends="mkdir">
        <javac srcdir="${src.dir}" destdir="${build.dest}" classpathref="classpath" />
    </target>

    <target name="package-bundle" depends="compile" description="Generates the bundle" >
        <jar destfile="${build.dest}/${bundlename}.jar" manifest="${src.dir}/META-INF/MANIFEST.MF">
            <fileset dir="${src.dir}">
                <include name="**/**.class" />
                <include name="**/**.properties"/>
                <include name="/META-INF/**.*" />
                <include name="/META-INF/spring/**.*" />
            </fileset>
        </jar>
    </target>

    <target name="all" depends="package-bundle">
    </target>

</project>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:21:37+00:00Added an answer on June 11, 2026 at 9:21 am

    Firstly, what do you mean by “tried {build.dest} in making the jar”?

    Whatever, you need to take a look at this part of your build:

    <jar destfile="${build.dest}/${bundlename}.jar" manifest="${src.dir}/META-INF/MANIFEST.MF">
        <fileset dir="${src.dir}">
            <include name="**/**.class" />
            <include name="**/**.properties"/>
            <include name="/META-INF/**.*" />
            <include name="/META-INF/spring/**.*" />
        </fileset>
    </jar>
    
    1. You compiled class files are in ${build.dest}, so you should use ${build.dest} as the root dir for the nested <fileset> of the <jar> task. But now you are pointing the <fileset> to your source code folder.
    2. You should avoid putting the generated jar file in the same directory where the class files are. For example, you can put the jar in ${dist.dir}, which is another directory.

    So try this:

    You have a property:

    <property name="dist.dir" value="../build/dist" />
    

    And then,

    <jar destfile="${dist.dir}/${bundlename}.jar" manifest="${src.dir}/META-INF/MANIFEST.MF">
        <fileset dir="${build.dest}">
            <include name="**/*.class" />
        </fileset>
        <fileset dir="${src.dir}">
            <include name="**/*.properties"/>
            <include name="/META-INF/**/*.*" />
            <include name="/META-INF/spring/**/*.*" />
        </fileset>
    </jar>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a build.xml file that works fine. The problem is that the generated
I have a problem creating and executing a JAR file. I have already made
I use ant for creating .jar files in Eclipse. Works great. I have a
I'm creating a .jar file that has a GUI: jar cmf mainClass patcherFull.jar pack
I am creating a jar file of a javaagent that I have written. However,
I am trying to go through the process of creating a jar file from
Separate Jars When creating JAR files, I've always kept the source separate and offered
I’m creating an executable JAR that will read in a set of properties at
I need to create a jar file using eclipse IDE. But I am facing
nimbus look and feel not appear after creating jar when i run program in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.