Clone
Rodrigo B. de Oliveira
committed
on 27 May 16
Attempt to reproduce 'loader constraint violation'
This is a work in progress attempt at reproducing the 'loader constraint
violation' obser… Show more
Attempt to reproduce 'loader constraint violation'

This is a work in progress attempt at reproducing the 'loader constraint

violation' observed when defining the following task:

   task<Zip>("repackageKotlinCompilerEmbeddable") {

       baseName = "kotlin-compiler-embeddable"

       version = "${kotlinVersion}a"

       extension = "jar"

       entryCompression = ZipEntryCompression.STORED

       from(Callable {

           val files = configurations.getByName("compile").files

           zipTree(files.single { it.name.startsWith(baseName) })

       })

       exclude("META-INF/services/java.nio.charset.spi.CharsetProvider")

       destinationDir = buildDir

       description = "Repackages '$baseName:$version' to remove broken META-INF/services files"

   }

Which caused the following error:

   loader constraint violation: when resolving method

   "org.gradle.script.lang.kotlin.ProjectExtensionsKt.task(

   Lorg/gradle/api/Project;Ljava/lang/String;Lkotlin/reflect/KClass;

   Lkotlin/jvm/functions/Function1;)Lorg/gradle/api/Task;"

   the class loader (instance of

   org/jetbrains/kotlin/codegen/GeneratedClassLoader) of the current

   class, Build_gradle, and the class loader (instance of

   org/gradle/internal/classloader/MutableURLClassLoader) for the method's

   defining class, org/gradle/script/lang/kotlin/ProjectExtensionsKt, have

   different Class objects for the type kotlin/reflect/KClass used in the

   signature

See #25

Show less

master + 353 more