2

I have an issue where my automated build environment necessitates a different version of ant than the actual delegated scripts being run to produce the build.

I do not have an environmental variable for ANT_HOME. I throw my CI environment the ANT_HOME to a directory of ant-1.7.0 But i need to override or unset ANT_HOME to a directory of ant-1.6.5 so the targets I call don't inherit the ANT_HOME, and run out of the 1.7.0 folder.

Can anyone think of a good way to do this? I can't modify the delegated targets of the build script but I can modify anything in the front end.

I'm using Cruisecontrol2.8.4 and the aforementioned ant versions.

Edit: The build targets I call set their own ANT_HOME to the 1.6.5 folder but it is being ignored as the previously set ANT_HOME to invoke cruisecontrol is immutable

yep
  • 1,263
  • 1
  • 9
  • 13

2 Answers2

1

You can unset properties with AntContrib.

In your ant script...

Import AntContrib:

<taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
        <pathelement location="folderwithantcontribjar/ant-contrib-1.0b3.jar"/>
    </classpath>
</taskdef>

Do the unset:

<var name="ANT_HOME" unset="true"/>

This removes ANT_HOME from the current set of properties allowing it to be set again.

Adam Bruss
  • 1,654
  • 14
  • 18
  • 2
    Oh wow, thats exactly what I needed. We had been using antContrib for other tasks, i didnt even think to see if such a thing existed in that package. Thanks. – yep Oct 03 '11 at 15:15
0

Try setting the anthome attribute of the ant builder in your cruisecontrol configuration file :

http://cruisecontrol.sourceforge.net/main/configxml.html#ant

This should call your version of ant and presumably all called ant scripts will also use this version.

FailedDev
  • 26,680
  • 9
  • 53
  • 73