Kotlin 1.2.50: Compile failed: A required class was missing: kotlin/reflect/KDeclarationContainer


#1

I have a very similar problem to the one described here

I have a Maven project that compiles fine under IntelliJ, but when I try to compile it with Maven on the command line when using Kotlin 1.2.50 or higher, I get this error:

kotlin-maven-plugin:1.2.51:compile failed: A required class was missing while executing org.jetbrains.kotlin:kotlin-maven-plugin:1.2.51:compile: kotlin/reflect/KDeclarationContainer

[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.2.51:compile (compile) on project myproj: 
Execution compile of goal org.jetbrains.kotlin:kotlin-maven-plugin:1.2.51:compile failed: 
A required class was missing while executing org.jetbrains.kotlin:kotlin-maven-plugin:1.2.51:compile: kotlin/reflect/KDeclarationContainer
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.jetbrains.kotlin:kotlin-maven-plugin:1.2.51
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/home/user/.m2/repository/org/jetbrains/kotlin/kotlin-maven-plugin/1.2.51/kotlin-maven-plugin-1.2.51.jar
[ERROR] urls[1] = file:/home/user/.m2/repository/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar
[ERROR] urls[2] = file:/home/user/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar
[ERROR] urls[3] = file:/home/user/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[4] = file:/home/user/.m2/repository/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9.jar
[ERROR] urls[5] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[6] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar
[ERROR] urls[7] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[8] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[9] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[10] = file:/home/user/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.4/maven-plugin-annotations-3.4.jar
[ERROR] urls[11] = file:/home/user/.m2/repository/org/jetbrains/kotlin/kotlin-compiler/1.2.51/kotlin-compiler-1.2.51.jar
[ERROR] urls[12] = file:/home/user/.m2/repository/org/jetbrains/kotlin/kotlin-scripting-compiler/1.2.51/kotlin-scripting-compiler-1.2.51.jar
[ERROR] urls[13] = file:/home/user/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.5.1/maven-compiler-plugin-3.5.1.jar
[ERROR] urls[14] = file:/home/user/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
[ERROR] urls[15] = file:/home/user/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
[ERROR] urls[16] = file:/home/user/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[ERROR] urls[17] = file:/home/user/.m2/repository/org/apache/maven/shared/maven-shared-incremental/1.1/maven-shared-incremental-1.1.jar
[ERROR] urls[18] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-compiler-api/2.7/plexus-compiler-api-2.7.jar
[ERROR] urls[19] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/2.7/plexus-compiler-manager-2.7.jar
[ERROR] urls[20] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/2.7/plexus-compiler-javac-2.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------
[ERROR] : kotlin.reflect.KDeclarationContainer
[ERROR] -> [Help 1]

This error doesn’t happen under Kotlin 1.2.41

Any ideas on how to fix this?


#2

Can you please create an issue on http://kotl.in/issue and attach your project (can be done privately) so we can try to reproduce this problem?