cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to execute . ./setantenv.sh with Jenkins

Former Member
0 Kudos
1,397

Jenkins seems to fail when trying to run . ./setantenv.sh (I think it has a problem with . ./).

sh setantenv.sh works but then ant cannot be found

bash setantenv.sh does the same as above.

Anyone got this working?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

I think, the following should work:

 bash -c ". ./setantenv.sh && ant"

Thus, you'll st bash, load the ant environment into that shell and execute ant.

Former Member
0 Kudos

This will be the first thing I do tomorrow. Thanks!

Answers (6)

Answers (6)

Former Member
0 Kudos

Use Jenkins "Exec command" and do:

. /path/setantenv.sh ant clean all

Former Member
0 Kudos

there's a bash builtin "source" which does the same thing: http://ss64.com/bash/source.html

Former Member
0 Kudos

I fixed this by doing something a little lame, but works and doesn't require me to extract out the details of the setantenv script. I had an issue with Simply call the setantenv.sh script from another bash script. The shebang at the top will tell /bin/sh to go to the right place to run the script and it will also satisfy setantenv.sh's . ./ requirement.

 #!/bin/bash
 . ./setantenv.sh
Former Member
0 Kudos

make sure /bin/sh points to /bin/bash - you can do this dpkg-reconfigure dash on debian. Then just source the setantenv.sh file and it should work

Former Member
0 Kudos

I kind of like what Christoph is saying but we did it a different way. The setantenv.sh script doesn't do every much and it also does one thing which is kind of annoying (setting the heap size ridiculously small).

This is what the script does

 PLATFORM_HOME=`pwd`
 export -p PLATFORM_HOME
 export -p ANT_OPTS="-Xmx200m -XX:MaxPermSize=128M"
 export -p ANT_HOME=$PLATFORM_HOME/apache-ant-1.9.1
 chmod +x "$ANT_HOME/bin/ant"
 export -p PATH=$ANT_HOME/bin:$PATH

You could set these as normal env variables or script them into your Jenkins job which also allows you to increase the heap size for ant.

christoph_meyer
Active Participant
0 Kudos

Why not just create an ant build step inside your jenkins job? You can configure the ant version and just give the tasks to run. There should be no need to call ant via shell.

Former Member
0 Kudos

Thats what we did also. As we know that hybris is running ant 1.9.1; we got it from apache ( http://archive.apache.org/dist/ant/binaries/) and installed it directly on the machine, then linked that installation with hudson/jenkins, and use it to build hybris.