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 8028939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:16:59+00:00 2026-06-05T00:16:59+00:00

I am new to Ant build script. I am trying to do following things

  • 0

I am new to Ant build script. I am trying to do following things

  1. Delete the build directory
  2. Create the build directory
  3. Compile the code
  4. Create jar file for each package in the project

for this I have written following code

<?xml version="1.0"?>
<project name="test" basedir=".">
    <property name="build.lib" value="dist"/>
    <property name="prefix" value="XXX"/>
    <property name="src.dir" value="src"/>
    <property name="build.dir" value="build"/>
    <property name="build.classes" value="${build.dir}/classes"/>
    <property name="jar.dir" value="${build.dir}/jar"/>

    <path id="compile.classpath">
        <fileset dir="OpenJPA_lib_jar">
            <include name="*.jar"/>
        </fileset>
    </path>

<macrodef name="build_jar">
    <attribute name="name"/>
    <sequential>
        <jar destfile="${build.lib}/${prefix}-@{name}.jar">
            <fileset dir="${build.classes}">
                <include name="zumigo/geofence/@{name}/**"/>
            </fileset>
        </jar>
    </sequential>
</macrodef>

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

<echo message="Build dir = ${build.dir}"/>

    <target name="prepare">
        <mkdir dir="${build.dir}"/>
    </target>

    <target name="compile" depends="prepare">
        <javac destdir="${build.classes}" debug="true" srcdir="${src.dir}">
            <classpath refid="compile.classpath"/>
        </javac>
    </target>

<target name="run" depends="compile">
        <build_jar name="common"/>
    <build_jar name="dal"/>
    <build_jar name="databeans"/>
    <build_jar name="dataobject"/>
    <build_jar name="dto"/>
    <build_jar name="exception"/>
    </target>

</project>

When I execute the ant script on command line with verbose option it gives me following output

Apache Ant(TM) version 1.8.3 compiled on February 26 2012
Trying the default build file: build.xml
Buildfile: E:\XXX\XXXWorkspaces\GeoFence\v1.0\GeoFence_Java\build.xml
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_14\jre
Detected OS: Windows XP
parsing buildfile E:\XXX\XXXWorkspaces\GeoFence\v1.0\GeoFence_Java\build.xml with URI = file:/E:/XXX/XXXWorkspaces/GeoFence/v1.0/GeoFence_Java/build.xml
Project base dir set to: E:\XXX\XXXWorkspaces\GeoFence\v1.0\GeoFence_Java
parsing buildfile jar:file:/D:/Downloads/apache-ant-1.8.3/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/D:/Downloads/apache-ant-1.8.3/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [macrodef] creating macro  build_jar
 [echo] Build dir = build

BUILD SUCCESSFUL
Total time: 0 seconds

I even tried debugging the script in eclipse. The debug point was set at the “prepare” target and when we press F5 it exits the debugging. It does not show any error message.

Can anyone let me know what is wrong in the script?

  • 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-05T00:17:00+00:00Added an answer on June 5, 2026 at 12:17 am

    You didn’t tell Ant which target to run. Either specify -p (or select a target to run in the Eclipse Ant runner) or define a default target to run in the <project> tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a custom ant script to automatically create a jar file each time
I am new to ant, but am trying to create an ant script that
I have following script which is aim to make a war file. def ant
I want to execute an ant build through java code. I use the following
I have an ant build script that errors out with the following message. javac
i need to write an ant (build.xml) file to do the following: - run
My ANT build script uses a WebSphere command called createEJBStubs that produces a JAR
How do I use Ant ( bb-ant-tools ) to compile a JAR file into
I'm working on a new project with a full ANT build. I use eclipse
How do I add a new directory into my CVS repository using Ant? From

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.