2009/2/22 Russel Winder <[email protected]>
> Tom,
>
> On Sun, 2009-02-15 at 23:36 +0100, Tom Eyckmans wrote:
> > Hi Russel,
> >
> > I've looked at this and I've found the following:
> >
> > you have a groovyVersion property in the Gant build this in
> > combination with the GROOVY_HOME environment variable cause problems
> > when they are not aligned to the same Groovy version, so when in the
> > Gant build the groovy16version is used the GROOVY_HOME should point to
> > a Groovy 1.6 directory, and when groovy15version is used in the build
> > GROOVY_HOME should point to a Groovy 1.5 directory.
> >
> > When I align them the build seems stable (ran it a couple of times for
> > Groovy 15 and 16 ).
>
> Thanks for taking a look at this. I made time to take a look at this
> further myself this afternoon. I am rapidly confirming a hypothesis!
>
> The problem I am seeing is that Gradle appears to be finding an
> alternative instance of Groovy to the one in GROOVY_HOME. In particular
> I have Gant 1.6.1 installed from an Ubuntu package and that includes
> Groovy 1.6.0 in its lib directory, as well as having Groovy
> 1.7-beta-1-SNAPSHOT (i.e. Trunk) and Gant 1.7.0-SNAPSHOT installed in my
> personal area.
>
> When a Gant job is spawned by Ant, Gant, Eclipse or IntelliJ IDEA, it
> picks up the PATH and GROOVY_HOME environment variables and hence finds
> my personal Gant and Groovy. When Gradle spawns a Gant job it seems to
> be finding the Gant in /usr/share/gant. Here lies the seeds of two
> versions being used in two different phases of the test build which
> leads to the errors I am seeing.
>
> So my current hypothesis is that Gradle is spawning jobs without
> inheriting the environment variables from the original shell whereas
> Ant, Gant, Eclipse and IntelliJ IDEA are all picking them up.
The when you run the JUnit tests in a forked the default of the JUnit Ant
task is not to inherit the environment, you can force this behaviour by
adding the following to your test block:
test {
options.fork(cloneVm:true)
}
if you want more control over the environment JUnit is run in you can do the
following:
test {
options.fork(
environment:[
'GROOVY_HOME': '/home/russel/my-groovy',
'GANT_HOME':'/home/russel/my-gant'])
}
>
>
> However, I may be barking up the wrong tree.
Not sure why the tests are passing in the other tools because the default of
the JUnit Ant task that we are using is not to inherit the environment.
>
>
> --
> Russel.
> ====================================================
> Dr Russel Winder Partner
>
> Concertant LLP t: +44 20 7585 2200, +44 20 7193 9203
> 41 Buckmaster Road, f: +44 8700 516 084
> London SW11 1EN, UK. m: +44 7770 465 077
>