Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Setting Environment Variables for Ant Execution

Hello,

I have an Ant build in which we use exec tasks to run a shell script used to do some special compiles. The script, which I don't own and cannot update, requires environment variables to be set in order to succeed.

Is there a say in RTC 3 that I can specify environment variable settings in the build definition or build engine?

Thank you,
John Czukkermann
IBM Corp.

0 votes



3 answers

Permanent link
John,

how are the environment variables accessed?

You can pass properties that are defined in the build definition or the build engine to ANT and they show up as properties there.

If that is not sufficient, what you could try:

I had a similar issue with a cmd-line build before we had an option to provide environment variables. What I did then, I believe, was to run an ANT script, set the environment variables and call the next ANT script.

You could also use the CMD based build, do the same and call ANT from the command.

0 votes


Permanent link
Hi Ralph,

Thanks for the ideas.

What I ended up doing was creating a new version of the shell script in which I added command-line support to specify the required PATH additions. That worked, but when I offered it to the person that supports the shell script, they asked a really good question: Why don't you just specify the PATH as part of the command?

For example:

PATH=mypath1:mypath2:mypath3 doSpecialCompile -a1 arg1 -a2 arg2

So I ended up with an exec task like this:

<exec>
<arg>
</exec>

0 votes


Permanent link
Thanks for the feedback. I couldn't see the code - there is an issue with XML code if pasted. I am glad you got it working.

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Feb 08 '12, 7:59 a.m.

Question was seen: 7,040 times

Last updated: Feb 08 '12, 7:59 a.m.

Confirmation Cancel Confirm