mercredi 6 mai 2015

ANT property environment="env" unable to retrieve it in JAVA but works fine if run as ant command

I've a build file which will be called from java. Please find the build.xml below.

<property environment="env"/>
  <echo message="${env.PATH}"/>
  <echo message="${env.SSH_CONNECTION}"/>
  <echo message="${env.JAVA_HOME}"/>
  <echo message="${env.HOME}"/>
  <echo message="${env.IS_HOME}"/>
  <echo message="${basedir}"/>

Unable to fetch the environment variables if its run through java class. But the same works fine if run as ant command like "ant". Please help

iF run as JAVA then error is

--- MESSAGE LOGGED
Property ${env.JAVA_HOME} has not been set
--- MESSAGE LOGGED
     [echo] ${env.JAVA_HOME}

But i could see that the environment variables are set fine. If i echo the variables command line , im able to see the value.

Aucun commentaire:

Enregistrer un commentaire