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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:11:36+00:00 2026-06-02T03:11:36+00:00

When I use Makefiles, I could include common.mk file, where I define in it

  • 0

When I use Makefiles, I could include common.mk file, where I define in it some common definitions, such as classpath, and such.

I’d like to do the same with my build.xml files. I’d like to create a build.xml in each folder in my tree, this way I can build any part of the tree without having to edit the one top build.xml each time to tell it what to include.

This is how I did it with makefiles, and was very nice, since I can type ‘make’ from any folder in the tree, and using recursive make, it will build the tree part below where I was.

The problem with build.xml’s, is that I find I duplicate same definitions in each build.xml (such as classpath, and compiler flags and what-have-you).

If I can include an xml file, then I can put all the common things in the common.xml file, in the root of the tree, and include that in each build.xml. (this is what I did with the Makefiles, I put everything in common.mk).

I do not like to use env. variables to define things, and prefer to use a file, a common file, that I use for the whole tree.

I am new at using ant, and so I might have overlooked this feature. If someone has an example of how to this also, this will be useful.

cheers,

  • 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-02T03:11:38+00:00Added an answer on June 2, 2026 at 3:11 am

    Check out the documentation for including XML files and external Ant files:
    http://ant.apache.org/faq.html#xml-entity-include

    to include a complete Ant build file inside of the current Ant file, you’ll need to do something like this:

    <?xml version="1.0"?>
    <project name="test" default="test" basedir=".">
    
      <target name="setup">
        ...
      </target>
    
      <import file="./common.xml"/>
    
      ...
    
    </project>
    

    you’ll need Ant 1.6 or newer.

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

Sidebar

Related Questions

At work we use a common makefile that other makefiles include (via the include
BACKGROUND We use Makefiles as one part of our regression suite. We have some
I use a cmake generated makefile to compile a c++ file that depends on
I've stumbled on a make file Makefile.am and I tried to use make -f
Use case: I've just entered insert mode, and typed some text. Now I want
I would like some help in setting up a project in SVN with regards
I use TeamCity to build c++ on Unix (Solaris). TeamCity invokes make, and within
I find I'm writing a lot of Makefiles that could be cleaned up with
I'm trying to do file uploads with ruby 1.8 and it seems like there
In theory, it's very easy to build a Win32 app with a resource file

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.