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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:01:35+00:00 2026-06-12T18:01:35+00:00

I have the following Ant buildfile importer.xml : <project name=importer basedir=.. default=build> <import file=imported.xml/>

  • 0

I have the following Ant buildfile importer.xml:

<project name="importer" basedir=".." default="build">
    <import file="imported.xml"/>

    <target name="build">
        <!-- Do some stuff... -->

        <property name="isRunningFromImporter" value="true"/>
        <antcall target="run-now"/>
    </target>
</project>

And another buildfile imported.xml that uses the ant-contrib tasks:

<project name="importer" basedir=".." default="build">
    <!-- Most of file omitted for brevity -->

    <target name="run-now">
        <if>
            <not-equals arg1="${isRunningFromImporter}" arg2="true"/>
            <then>
                <!--
                    This should only execute when the
                    isRunningFromImporter property is not true.
                -->
            </then>
        </if>
    </target>
</project>

The imported#run-now target can be ran as a standalone Ant task, for example:

ant -buildfile imported.xml run-now

In this case I do not want the <then> clause/task executed. However, if you run the same task as it is imported into importer.xml:

ant -buildfile importer.xml build

Then I want the <then> clause/task to execute, however, Ant does no allow me to see a property in one file and read it in another. Any ideas? Thanks in advance!

  • 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-12T18:01:39+00:00Added an answer on June 12, 2026 at 6:01 pm

    It does what you want by default. Antcall’s “inheritAll” attribute is set to true.

    Running the following code echo’s “true” showing the property is in fact set.

    <project name="importer" basedir=".." default="build">
        <import file="imported.xml"/>
    
        <target name="build">
            <!-- Do some stuff... -->
    
            <property name="isRunningFromImporter" value="true"/>
            <antcall target="run-now"/>
        </target>
    </project>
    
    <project name="importer" basedir="..">
        <!-- Most of file omitted for brevity -->
    
        <target name="run-now">
    
            <echo>${isRunningFromImporter}</echo>
        </target>
    </project>
    

    I’m not familiar with <not-equals arg1="${isRunningFromImporter}" arg2="true"/>. I’ve always used <not><equals ...> instead. Where does not-equals come from? Are you sure the problem isn’t in that line?

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

Sidebar

Related Questions

I have following ant file to build. But unfortunately <project default=build.deploy.start basedir=.> <property name=target.dir
I have the following Ant build file: <?xml version=1.0 encoding=UTF-8?> <project default=build name=MyAntScript> <!--
I have following ant script to generate the jar file <project name=myProject basedir=. default=jar>
I have an ant script with the following header: <project name=Simple ActiveJDBC Example default=clean
I have the following ant task: <target name=test> <replace file=test.txt token=smth value=anything/> </target> test.txt
I have the following ant build.xml : <path id=antclasspath> <fileset dir=lib> <include name=*.jar/> </fileset>
i have the following code snippet in my ANT File which compiles my project
I have the following section to print the ant build info into a file.
I have following target in mz ant script to build my java application <target
I have this following snippet in my ANT-buildfile, which reads filenames from a 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.