ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: How to set global properties?
Date Mon, 02 Aug 2004 12:36:56 GMT
You have to pass the property to the antcalled targets.

But you should think about reorganizing your buildscript. 
It seems that you want to have a common buildfile for several modules. 
Here the <import> is a good task to use:

common.xml
<project>
  <!-- all the targets -->
</project>

logging/build.xml
<project>
    <!-- set the individual properties -->
    <property name="archive" value="logging"/>

    <!-- make all targets available -->
    <import file="../common.xml"/>
</project>

appintegration/build.xml
<project>
    <!-- set the individual properties -->
    <property name="archive" value="appintegration"/>

    <!-- make all targets available -->
    <import file="../common.xml"/>
</project>


Some weeks ago there was a discussion about that. I think Erik had
set up some modules in a Jakarta project in that way - but I dont know.


Jan

> -----Urspr√ľngliche Nachricht-----
> Von: Angeshwar Deepak [mailto:angeshwar@yahoo.com]
> Gesendet am: Montag, 2. August 2004 14:30
> An: user@ant.apache.org
> Betreff: How to set global properties?
> 
> How to set global properties?
> 
> Hi I have a build files as follows
> 
> <?xml version="1.0"?>
> <project default="site" basedir="." name="forrest">
> <property name="version" value="0.5"/>
> 
> <taskdef
> resource="net/sf/antcontrib/antcontrib.properties"/>
> 	<target name="init-props">
> 		<foreach list="logging,appintegration"
> param="archive" target="base">  
> 		</foreach>
> ....
> ....
> <property name="forrest.home"       
> location="../setup" />
> <property name="project.name"       
> value="my-project"    />
> <property name="project.build-dir"  
> location="${project.home}/build"    />
> ....
> ....
> <antcall target=...../>
> </target>
> 
> <target name=...../>
> ....
> ....
> <antcall target=...../>
> </target>
> 
> <target name=...../>
> ....
> ....
> </target>
> 
> <target name="base" >
> <property name="current.archive" value="${archive}" />
> </target>
> 
> </project>
> 
> Now I want the content or value of ${current.archive} 
> or ${archive} to be available inside all the other 
> ant targets as well.
> 
> i.e. I should be able to use the ${archive} and
> ${current.archive} in other targets also like
> 
> <target name=...../>
> ....
> <property name="project.site-dir" 
> location="${project.build-dir}/test/report/html/{archive}"
>    />
> ....
> </target>
> 
> How can this be set? Somebody suggest some soltion.
> 
> bye,
> with regards,
> Deepak.
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
> http://mobile.yahoo.com/maildemo 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message