dromodel
dromodel

Reputation: 10243

Is is possible to access an environment variable in the Ant project element?

consider the following example:

<project basedir="${env.DIR}">
  ...
</project>

Is it possible to access an environment variable in the project element along these lines?

Upvotes: 3

Views: 357

Answers (2)

Joe
Joe

Reputation: 468

If you call your build file from Eclipse, to set the Base Directory property from the task that runs the ant build file you can:

  1. Right click on the build file
  2. Choose "Run As" -> "External Tool Configurations..."
  3. Under the "Main" tab, use the Base Directory box to enter the directory, but note the syntax of defining an environment variable here, for example if your environment variable is named "DIR", it would be: ${env_var.DIR}

Upvotes: 0

FailedDev
FailedDev

Reputation: 26940

No you can't. Neither can you use a property there. You have to change them from the way you call your build file. E.g. if you call it with another ant task , you can set the basedir attribute there.

Upvotes: 2

Related Questions