rules_kotlin
rules_kotlin copied to clipboard
1.6.0-RC-1: Mixing Java + Kotlin with some deps breaks due to module name issues, or something?
Sorry about the "or something". I've kinda stumbled my way into this repro and really don't understand any of the pieces in play, so I don't know if the title I chose is meaningful.
- Create a Bazel package with a
kt_jvm_library - Create a simple empty Java class
- Create a simple Kotlin file with one trivial data class
- Build -- it works! (I hope)
- Add these dependencies[1]:
"@maven//:com_graphql_java_graphql_java",
"@maven//:com_graphql_java_graphql_java_extended_scalars",
- Build -- it fails!! with this message:
error: cannot determine module name for bazel-out/darwin-fastbuild/bin/external/maven/v1/https/repo1.maven.org/maven2/com/graphql-java/java-dataloader/3.1.0/header_java-dataloader-3.1.0.jar
If it's helpful, it fails in the action 'Building example-java.jar stage. Happy to provide whatever else from my environment; I got here trying to build with JDK17, but it fails with JDK11 too, which works with the v1.5.0 release of rules_kotlin.
The problem does not occur in pure Kotlin compilations via kt_jvm_library, nor in java_library compilations.
[1] Here are the underlying maven_install artifacts:
"com.graphql-java:graphql-java-extended-scalars:17.0",
"com.graphql-java:graphql-java:17.1",
It actually seems to matter! Setting them both to 17.0 makes the problem go away.
I found these interesting issues:
https://github.com/graphql-java/graphql-java/issues/2285
This one is asking for a newer version of java-dataloader...
https://github.com/graphql-java/graphql-java/issues/2817
What happens if you use v18.1 (the latest version of graphql)?
I tried it again with com.graphql-java:graphql-java:18.1 but I'm still getting the same error. It seems like the second link you provided suggests that there isn't currently a released java-dataloader with the fix, nor is there a graphql-java using that (unreleased) fixed version of java-dataloader.
Is this error a matter of that library being fixed, then? I'm a little confused as to why it only happens with a Java + Kotlin kt_jvm_library.
Updating java-dataloader to com.graphql-java:java-dataloader:3.1.3 (https://github.com/graphql-java/java-dataloader/releases/tag/v3.1.3) fixes the issue.