Java Mailing List Archive

http://www.ant-tasks.com/

Home » Ant Users List »

RE: Retrieving key value pairs from URL and setting as system
property

raju

2008-03-20

Replies:

Hi gilbert,

Thanks for your replies.

This is what i am trying to acheive from within an Ant script:

Hit a URL say http://host/environment?name=test ,from which a get a response
a containing key-value pairs containing data about the environment.(could
this be done without writing the key-value data to a properties file by just
reading response with Ant?)

Next step is to set the key value pairs obtained as system env variable
key=env variable name and value=env variable value so that next time when i
run a command for ex: say wssmoke which needs these variables would pick
them up from environments variables rather than passing explicting to the
command as parameters.

Regards
Raj







Rebhan, Gilbert wrote:
>
>
>
>
> ...
> /*
> setting the env variables =
>
> <property name="env.FOO="/path/to/foo"/>
> <property name="env.BAR" value="/path/to/bar"/>
>
> accessing the env variables =
>
> <property environment="env"/>
> <echo>$${env.FOO} == ${env.FOO}</echo>
> <echo>$${env.BAR} == ${env.BAR}</echo>
>
> other already set env variables are also accessible
>
> <echo>$${env.JAVA_HOME} == ${env.JAVA_HOME}</echo>
> <echo>$${env.TOMCAT_HOME} == ${env.TOMCAT_HOME}</echo>
> */
>
> when using <property prefix="..."/> the variables are only
> living in the scope of your ant script.
>
>
>
>
> Maybe you want to set your variables in a wrapper start script
> for your ant scripts, f.e.
>
> @ echo off
>
> set ANT_OPTS=-Xmx1024m
> set ANT_HOME=C:\ant
> set JAVA_HOME=C:\Programme\JavaSoft\JDK\1.5.0_11
> set PATH=%JAVA_HOME%\bin;%PATH%;%ANT_HOME%\bin;C:\cvsnt;C:\ant_extralibs
>
> : DEFAULT
> call ant -f %1
>
> : DEBUG
> :call ant -debug -f %1
>
> : XML LOGGER
> :call ant -listener org.apache.tools.ant.XmlLogger -f %1
>
> : Performance Monitoring
> :call ant -listener ise.antelope.common.AntPerformanceListener -f %1
>
> pause
>
>
> Regards, Gilbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.