ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Import issues and built-in properties
Date Mon, 10 May 2004 08:54:13 GMT
Dear colleagues,

I am observing some strange beahviour with built in
properties, when using imports. I isolated the problem
to following simple ant scripts:

---- main.xml ----
<?xml version="1.0"?>
<project name="main" basedir="." default="usage">

    <import file="import.xml" optional="no"/>

    <target name="usage"/>

    <target name="echo" depends="-init"
description="Echoes project name property">
        <echo message="project name is
${project.name}"/>
    </target>
</project>
---- end of main.xml ----

and 

---- import.xml ----
<?xml version="1.0"?>
<project name="import" basedir="." default="usage">

    <target name="usage"/>

    <target name="-init" depends=""
description="Initializes the needed properties">
        <property name="project.name"
value="${ant.project.name}"/>
    </target>

    <target name="echo" depends="-init"
description="Echoes project name property">
        <echo message="project name is
${project.name}"/>
    </target>
</project>
---- end of import.xml ----

When I invoke 
ant -f import.xml echo
it outputs
[echo] project name is import
which is of course OK, but when i invoke
ant -f main.xml echo
it outputs
[echo] project name is main
which I think is not so OK since I define project.name
in import.xml and expect it to be "import".

I workarounded this for my concrete aims, but I think
that one has no chances of getting the import.xml's 
ant built-in properties. Is import task designed to
behave like this?

Next issue is that I want to make the -init target of
main.xml file depends on -init target of import.xml,
i.e. when main.-init target is called, import.-init is
called also. Is it possible to do it?

Thank you in advance for yuor help

Greetings Ivan


	
		
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message