Problem with outdated version of snakeyaml


(Vladimir Ritz Bossicard) #1

I want to create a Gradle plugin that depends on snakeyaml. The version shipped with gradle-1.8 is 1.6 and I would prefer to work with a more recent version.

Is there any plan to upgrade the library to a more recent version (I think it is included because of testng)

or is there another way to solve this problem?


(Benjamin Muschko) #2

Your plugin could resolve its own version of the library using a custom configuration. When your plugin uses the library assigned to the configuration you might want to load its classes with a thread context classloader. That’ll ensure that the classloader only uses the classes from your configuration and not the snakeyaml classes provided by the Gradle runtime.


(Vladimir Ritz Bossicard) #3

Thanks Benjamin for your answer. It’s really appreciated.

I dig a little bit more and it’s already at compile time (in the buildSrc project) that the problem occurs (I was previously working within an IDE, where everything works)

It seems that the problem is the gradleApi() that is included as a compile dependency. And there is a bug http://issues.gradle.org/browse/GRADLE-1715 related to that very problem.

One solution I will try is to split the plugin’s code to build the part that needs the newer version as a separate project and use the plugin classloader isolation at runtime.