ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J.C. Hamlin" <JHam...@successfactors.com>
Subject Ivy Settings Conditionally Use an Environment Variable?
Date Tue, 31 Jul 2012 20:04:22 GMT
I am looking for help with using Ivy and environment variables. Is there any way to conditionally
use an environment variable in ivysettings.xml, and if it is not set, then fall back on a
default? Basically, what we want is something like that if the IVY_SERVER environment variable
is set, use it, otherwise default to http://ivy:8081/. Kind of like how shell would do it
with a definition like ${IVY_SERVER:-http://ivy:8081}. I can’t find a way to achieve this
same behavior in Ivy.

We tried this in ivysettings.xml:

  <properties environment="env"/>
  <property name="ivy.repos.server" value="${env.IVY_SERVER}" override="false"/>
  <property name="ivy.repos.server" value="http://ivy:8081" override="false"/>

And it doesn't work. ivy.repos.server either ends up with the value of the environment variable
IVY_SERVER (which is desirable) or the value ${env.IVY_SERVER} if no environment variable
is defined (which is undesirable). So, in our attempt, the second property setting never happens.

Now I understand this is the way it works in ant, so this make Ivy consistent with how ant
works. However, ant has “condition”, which can achieve the actual effect that we want
like this:

  <condition property="ivy.repos.server" value="${env.IVY_SERVER}">
    <isset property="env.IVY_SERVER"/>
  </condition>
  <property name="ivy.repos.server" value="http://ivy:8081"/>

Is there a way to do this with Ivy? If not, that makes it pretty impossible to allow users
to use environment variables to override the default behavior of the system.

Any help would be appreciated. Thanks in advance.

-J.C.

[cid:imagec3b9bc.PNG@213241f7.47bde295]<http://www.successfactors.com>
Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message