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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:57:37+00:00 2026-06-14T14:57:37+00:00

I have created an ant project which has some targets inside. One target is

  • 0

I have created an ant project which has some targets inside. One target is called info, which displays all available targets. This target is set as the default:

<project name="XXX" basedir="." default="info">

Now I want this target to be called in case of target not found:

Target "infp" does not exist in the project "XXX"

I need this in case the user calls a target that doesn’t exist. Then I want the info to be displayed, so that he sees all the available options.

Thanks

  • 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-14T14:57:39+00:00Added an answer on June 14, 2026 at 2:57 pm

    ANT does not support this functionality. The “default” target is called if no target is specified on the command line.

    Instead I would suggest making your build self describing and teaching your users about ANT
    ‘s -p option.

    Example

    The following build file:

    <project name="demo" default="welcome">
    
        <description>
        The purpose of this build file is to explain how one
        can make an ANT file self describing
        </description>
    
        <target name="welcome" description="Print a hello world message">
            <echo message="hello world"/>
        </target>
    
        <target name="do-somthing" description="Print a dummy message">
            <echo message="hello world"/>
        </target>
    
        <target name="do-somthing-silent">
            <echo message="hello world"/>
        </target>
    
    </project>
    

    Can describe itself as follows:

    $ ant -p
    Buildfile: /home/mark/build.xml
    
        The purpose of this build file is to explain how one 
        can make an ANT file self describing
    
    Main targets:
    
     do-somthing  Print a dummy message
     welcome      Print a hello world message
    Default target: welcome
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a Java application which has the following Apache Ant build file:
I have created one Android Project with Ant build. And also created Test Project
I'd like to associate some ANT targets with my project's build in Eclipse. No
I have one Android Project. I created Junit test project for the same. I
I'm on debian-6. I have install ant,tomcat6,openjdk-6-jre. Now from eclipse which project would i
I have created a custom Ant task as per one of my previous posts
I have created some JQuery that will expand a div 'popup' on hover and
I have created an EDMX in visual studio 2010 SP1. It has been built
I'm new to maven and have got a project with some dependencies. Now Maven
I am on ubuntu 11.04. I have installed Jave jdk 7u7 recently which has

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.