Finally the Play functionality has arrived in Gradle
We have an issue with the classloader hierarchy in Play when using runPlayBinary. The Gradle Classloader contains libraries in an older version that shadow some of our own libraries. The library in case is guava. Here, Gradle uses com.google.guava:guava-jdk5:17.0
whereas we are using the newer guava version 18
. Due to classloading order, our application code wrongly uses the older Gradle version and breaks.
// Somewhere in Play Application: System.out.println(com.google.common.util.concurrent.MoreExecutors.class.getResource("MoreExecutors.class")); System.out.println("=========================================="); System.out.println(Arrays.toString(((URLClassLoader) this.getClass().getClassLoader().getParent().getParent().getParent()).getURLs()));
which returns
`
jar:file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/guava-jdk5-17.0.jar!/com/google/common/util/concurrent/MoreExecutors.class
[file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/gradle-base-services-2.6-rc-1.jar, file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/gradle-core-2.6-rc-1.jar, file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/gradle-cli-2.6-rc-1.jar, file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/gradle-native-2.6-rc-1.jar, file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/gradle-messaging-2.6-rc-1.jar, file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/slf4j-api-1.7.10.jar, file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/jul-to-slf4j-1.7.10.jar, file:/home/dev/.gradle/wrapper/dists/gradle-2.6-rc-1-bin/ca4lrp6t1xbzsi1l3ix7k0fab/gradle-2.6-rc-1/lib/guava-jdk5-17.0.jar]
`
The classloading order either needs to be changed, or the libraries (slf4j, guava etc.) need to be repackaged.
Not sure what workaround can be done for now…