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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:44:47+00:00 2026-06-16T20:44:47+00:00

I now see Ant has both an <include> task and an <import> task. According

  • 0

I now see Ant has both an <include> task and an <import> task.

According to the descriptions:

Include

Include another build file into the current project.

and

Import

Imports another build file into the current project.

So, why use one over the other?

Here’s my actual problem:

In our current build system, we are concatenating a bunch of JavaScripts and then minimizing them. The JavaScripts are located in a dozen different directories, and we are taking batches from each directory and concatenating them into five or six super minimized JavaScripts. Some of these files are copied into multiple super JavaScripts.

In order to make debugging easier, and the build a bit more flexible, I want to copy all of the files into the target/work/resources2 directory with each sub-directory under there representing a different super minimized JavaScript. For debugging purposes, we’ll include the non-minimized super JavaScript and the originals. The build script isn’t complex, but the whole section is taking up a lot of lines. I was thinking of putting the <copy> stuff into a separate XML file, so the whole thing looks like this:

<target name="process-resources"
     description="Concatenate and minimize the JavaScripts (using Maven lifecycle names for our targets">
     <!-- The following include the copying stuff -->
     <here.be.dragons file="${basedir}/reservations.xml"/>
     <here.be.dragons file="${basedir}/date.xml"/>
     <here.be.dragons file="${basedir}/select.xml"/>

     <for param="concat.dir">
         <fileset dir="${work.dir]/resources2"/>
         <sequential>
            <here.I.am.concatenating.and.minimizing/>
         </sequential>
    </for>
</target>

I see there are four possibilities:

  • Use <ant/> to call the files that do the copying
  • Use <import/> (which might not work because it might not be able to be included inside a target)
  • Use <include/> (which might not work because it might not be able to be included inside a target)
  • Use the Entity Include.

I am never crazy about using <ant/> or <antcall> although this might be a good time to do this. The Entity Include idea will work, but that’s something most people don’t understand, and I am afraid it will cause confusion for people who have to support what I’m doing. The <import> and <include> may not be able to be used in this situation, but I’m still curious what the differences are.

  • 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-16T20:44:48+00:00Added an answer on June 16, 2026 at 8:44 pm

    The documentation of import explains the difference:

    How is import different from include?

    The short version: Use import if you intend to override a target, otherwise use include.

    When using import the imported targets are available by up to two names. Their "normal" name without any prefix and potentially with a prefixed name (the value of the as attribute or the imported project’s name attribute, if any).

    When using include the included targets are only available in the prefixed form.

    When using import, the imported target’s depends attribute remains unchanged, i.e. it uses "normal" names and allows you to override targets in the dependency list.

    When using include, the included targets cannot be overridden and their depends attributes are rewritten so that prefixed names are used. This allows writers of the included file to control which target is invoked as part of the dependencies.

    It is possible to include the same file more than once by using different prefixes, it is not possible to import the same file more than once.

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

Sidebar

Related Questions

I have the following Ant buildfile importer.xml : <project name=importer basedir=.. default=build> <import file=imported.xml/>
Has anyone seen problems with UnionBugs ant task? My maven build generates findbugs via
now see tcp endpoint <endpoint address=tcp binding=netTcpBinding bindingConfiguration=tcpBinding contract=ChatService.IChat/> tcp endpoint address has no
I've been using C/C++ and Python, but I now I see that a lot
A term that I see every now and then is Cyclomatic Complexity. Here on
I thought this was covered elsewhere but I don't see it now. Anyway, having
copied a UITable to a other Storyboard, now I cannot see any rows ?
I see lot of new machines and laptops now having 64 bit hardware and
So I see that MVC 2 now supports [HttpPut] and [HttpDelete] as well as
(Problem solved now, see answers below) Hello, in my app I am trying to

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.