Kotlin + Java Modules + Maven === Fail


#1

I have a project using Java 10 (also works with Java 9) using kotlin 1.2.31, and the kotlin-maven-plugin

When I start adding module-info.java files to my projects, then the kotlin compiler fails with the stack trace below.

I’ve tried all the under-development version of the kotlin-maven-compiler, but no luck.

It looks like the compiler is using a re-packaged/shaded version of objectweb asm…

[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.2.31:compile (compile) on project athena_event: Compilation failure
[ERROR] java.lang.ArrayIndexOutOfBoundsException: 4
[ERROR] at org.jetbrains.org.objectweb.asm.ClassReader.readStringish(ClassReader.java:2659)
[ERROR] at org.jetbrains.org.objectweb.asm.ClassReader.readModule(ClassReader.java:2693)
[ERROR] at org.jetbrains.org.objectweb.asm.ClassReader.readModule(ClassReader.java:726)
[ERROR] at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:632)
[ERROR] at org.jetbrains.org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
[ERROR] at org.jetbrains.kotlin.resolve.jvm.modules.JavaModuleInfo$Companion.read(JavaModuleInfo.kt:67)
[ERROR] at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.modularBinaryRoot(ClasspathRootsResolver.kt:164)
[ERROR] at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.computeRoots(ClasspathRootsResolver.kt:118)
[ERROR] at org.jetbrains.kotlin.cli.jvm.compiler.ClasspathRootsResolver.convertClasspathRoots(ClasspathRootsResolver.kt:79)
[ERROR] at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:233)
[ERROR] at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:117)
[ERROR] at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.createForProduction(KotlinCoreEnvironment.kt:413)
[ERROR] at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:276)
[ERROR] at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:195)
[ERROR] at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63)

[ERROR] at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:108)
[ERROR] at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:52)
[ERROR] at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
[ERROR] at org.jetbrains.kotlin.maven.KotlinCompileMojoBase.execCompiler(KotlinCompileMojoBase.java:237)
[ERROR] at org.jetbrains.kotlin.maven.K2JVMCompileMojo.execCompiler(K2JVMCompileMojo.java:233)
[ERROR] at org.jetbrains.kotlin.maven.K2JVMCompileMojo.execCompiler(K2JVMCompileMojo.java:55)
[ERROR] at org.jetbrains.kotlin.maven.KotlinCompileMojoBase.execute(KotlinCompileMojoBase.java:220)
[ERROR] at org.jetbrains.kotlin.maven.K2JVMCompileMojo.execute(K2JVMCompileMojo.java:218)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] -> [Help 1]