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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:31:18+00:00 2026-05-11T16:31:18+00:00

Is there an Ant API for reading and ant build.xml and retrieving elements from

  • 0

Is there an Ant API for reading and ant build.xml and retrieving elements from it? Specifically I want to be able to retrieve the values in a path element and be able to walk all of the elements in the path.

My purpose is to retrieve a given path and ensure that it is referenced correctly in a manifest, so that the build and the manifest match when the product goes out to production.

EDIT: Regarding the responses (and thank you for them) to use an XML API, the problem is that the build file as currently constructed is more complex than that. Namely the classpath references a different classpath and includes it and the elements referenced in the classpath are themselves defined in a properties file, so there is too much of the Ant API to reasonably recreate.

  • 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-05-11T16:31:19+00:00Added an answer on May 11, 2026 at 4:31 pm

    You can use the ProjectHelper class to configure your project with a buildfile. If the path you want to check is contained in a reference, then you can just get the reference from the project by its ID.

    For example, if you have something like this in your build.xml:

    <path id="classpath">
        <fileset dir="${basedir}/lib" includes="*.jar"/>
    </path>
    

    Then you can get the Path reference with the following code:

    import java.io.File;
    
    import org.apache.tools.ant.Project;
    import org.apache.tools.ant.ProjectHelper;
    import org.apache.tools.ant.types.Path;
    
    public class Test {
        public static void main(String[] args) throws Exception {    
            Project project = new Project();
            File buildFile = new File("build.xml");
            project.init();
            ProjectHelper.configureProject(project, buildFile);
    
            Path path = (Path) project.getReference("classpath");
         }
    }
    

    Note that ProjectHelper.configureProject is deprecated in ant 1.6.2, but not in 1.7.

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

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Try using this to perform the redirect: <?php header('HTTP/1.1 302… May 11, 2026 at 11:29 pm
  • Editorial Team
    Editorial Team added an answer TControl.BringToFront; will usually do it. May 11, 2026 at 11:29 pm
  • Editorial Team
    Editorial Team added an answer As of version 1.1 and greater, the Django dumpdata management… May 11, 2026 at 11:29 pm

Related Questions

I want to know if i can create a custom google maps application,on which
We currently use a hand-rolled setup and configuration script and a hand-rolled continuous integration
Is there an ANT Task that would execute a block only if a given
Is there an Ant equivalent to the 'profile' concept in Maven? I'd like to

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.