You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Angeshwar Deepak <an...@yahoo.com> on 2004/07/30 11:52:49 UTC

How to set common properties?

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


Re: How to set common properties?

Posted by Angeshwar Deepak <an...@yahoo.com>.
Hi,

May be I was not clear last time, in the example I had
mentioned, I have a defined path for ${component}.

I want this ${component} 's path alone to be repeated.
i.e. In my new xml file I should simply be able to
specify 
...
... href="${component}"
...
...
and ant should refer to the corresponding path
referred in some other file.

bye,
with regards,
Deepak.
--- Ivan Ivanov <ra...@yahoo.com> wrote:

> 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 <an...@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
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
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


Re: How to set common properties?

Posted by Ivan Ivanov <ra...@yahoo.com>.
Hi,
${component} will get expanded to its value only
it has been defined in the properties file or in the
build file.
I still do not understand what you are trying to do
can you give some more information on what and why you
want this?

Regards Ivan
--- Angeshwar Deepak <an...@yahoo.com> wrote:

> Hi,
> 
> I created a file common.properties and the data in
> the
> file is 
> 
> #common.properties
> component.dir=${component}
> 
> Then I incllude the foloowing in the new xml file
> 
> <property name="common.properties.location"
> value="../_setup" />
> <property
>
file="${common.properties.location}/common.properties"
> />
> 
> On running the build with verbose.
> 
> init-props:
> Override ignored for property project.home
> Loading
> D:\deepak\buildProcess_2\_setup\common.properties
> Property ${component} has not been set
> Loading project specific properties from
> D:\deepak\buildProcess_2\logging\forrest.properties
> 
> ********* Project home: ${component}
>         
> ....
> ....
> 
> On echoing I simply get the ${component} and not the
> substituted string.
> 
> Whwere doI go wrong.
> 
> bye,
> with regards,
> Deepak.
> --- Ivan Ivanov <ra...@yahoo.com>
> wrote:
> 
> > 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 <an...@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
> > 
> > 
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - 50x more storage than other providers!
> 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!?
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


Re: How to set common properties?

Posted by Angeshwar Deepak <an...@yahoo.com>.
Hi,

I created a file common.properties and the data in the
file is 

#common.properties
component.dir=${component}

Then I incllude the foloowing in the new xml file

<property name="common.properties.location"
value="../_setup" />
<property
file="${common.properties.location}/common.properties"
/>

On running the build with verbose.

init-props:
Override ignored for property project.home
Loading
D:\deepak\buildProcess_2\_setup\common.properties
Property ${component} has not been set
Loading project specific properties from
D:\deepak\buildProcess_2\logging\forrest.properties

********* Project home: ${component}
        
....
....

On echoing I simply get the ${component} and not the
substituted string.

Whwere doI go wrong.

bye,
with regards,
Deepak.
--- Ivan Ivanov <ra...@yahoo.com> wrote:

> 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 <an...@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
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
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


Re: How to set common properties?

Posted by Ivan Ivanov <ra...@yahoo.com>.
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 <an...@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