michael nesterenko
michael nesterenko

Reputation: 14449

get ANT_HOME for configured ant in shell

I have an ant installation configured in jenkins (Manage Jenkins->Ant Installations). I have a build step Execute shell where I need to call ant targets. How can I get ANT_HOME for specific ant installation or configure that shell needs to have ANT_HOME for specific installation?

Upvotes: 0

Views: 434

Answers (1)

F.Rosado
F.Rosado

Reputation: 507

JAVA_HOME is setting when you select an ANT Step, the shell script will use the ANT_HOME setted on the server as environment variable. A solution is write the ANT_HOME value during an ANT task on a file on the workspace.

<echo message="${ant.home}" file="anthome.txt" />

The shell script read this file and use it for launch ant targets.

FOR /F %i IN (anthome.txt) DO SET ANT_HOME=%i

In any case perhaps is easier to have a ant script for launch other ant targets that your approach.

Upvotes: 1

Related Questions