Test classpath has duplicate entries when running a gradle 1.8 build under teamcity

I have a number of builds that have been upgraded to gradle 1.8 and which run normally from the command line. They consistently fail when run from TeamCity with a LinkageError during some tests. Investigation shows the classpath send to the test worker jvm is full of duplicates, specifically this line

[org.gradle.process.internal.DefaultWorkerProcessFactory] Using implementation classpath

contains a variable number of duplicate entries

Meanwhile this line

[org.gradle.process.internal.DefaultWorkerProcessFactory] Using application classpath

contains exactly 2 of everything.

The behaviour is reminiscent of some data structure losing set like behaviour so it spits out n entries instead of 1 (though looking at the source code suggests the application classpath can’t contain duplicates as it is a Set)

I don’t know if this is best raised here or with teamcity but thought I’d post here for starters as it is related to how the test task classpath is formed.

This appears to be a teamcity issue when using the intellij coverage runner. I will report it to jetbrains.