ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Ivanov <rambiusparkisan...@yahoo.com>
Subject Re: How to set common properties?
Date Fri, 30 Jul 2004 10:27:01 GMT
Hi there are several ways
1) externalize the properties in property file:
#common.properties
deploy.home=${build.test.report.html}/${component}
...
in your build xml files do
<property name="commom.properties.location"
value="...">
<property
file="${commom.properties.location}/common.properties">
and then you can use the properties defined in the
common.properties file. You need only to adjust its
location.

2) Use <import>
Create commonprops.xml and define your properties
there
<!-- commonprops.xml-->
<project name="commonprops" basesdir=".">
<property name="deploy.home"
value="${build.test.report.html}/${component}"/>
<property name="deploy.src"
location="${src}/documentation/content/xdocs/${component}"/>
</project>
...
(note that this is ant script) and then <import> it
in your build  files:
<property name="commom.properties.location"
value="...">
<import file="commonprops.xml"/>

3) Use XML entities 
Create commonsnippet.xml and define your properties in
it
<!-- commonsnippet.xml-->
<property name="deploy.home"
value="${build.test.report.html}/${component}"/>
<property name="deploy.src"
location="${src}/documentation/content/xdocs/${component}"/>
</project>
...
(note that this is NOT a valid ant script it is just a
fragment). Then in your build files do:
<!DOCTYPE project[
    <!ENTITY commonproperties
      SYSTEM "file:path_to_commonsnippet.xml">
]>
<project name="..." ...>
<!-- import external XML fragment -->
&commonproperties;
</project>

HTH Ivan
--- Angeshwar Deepak <angeshwar@yahoo.com> wrote:

> Hi,
> 
> I have a set some properties with attributes
> name and value.
> 
> e.g.
> 
> <property name="deploy.home"
> value="${build.test.report.html}/${component}"/>
> <property name="deploy.src"
>
location="${src}/documentation/content/xdocs/${component}"/>
> 
> I want the same set of property names to be used in
> a
> different xml file.
> How can I include it.
> 
> i.e. in a different xml file I want to use something
> like
> 
> <copy todir="${deploy.home}">
> ....
> ....
> </copy>
> 
> and still want ant to understand the content of
> ${deploy.home}.
> 
> How can this be done.
> 
> bye,
> with regards,
> Deepak.
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - Send 10MB messages!
> http://promotions.yahoo.com/new_mail 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

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


Mime
View raw message