rules_kotlin icon indicating copy to clipboard operation
rules_kotlin copied to clipboard

1.6.0-RC-1: Mixing Java + Kotlin with some deps breaks due to module name issues, or something?

Open zack-sampson opened this issue 3 years ago • 3 comments

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.

  1. Create a Bazel package with a kt_jvm_library
  2. Create a simple empty Java class
  3. Create a simple Kotlin file with one trivial data class
  4. Build -- it works! (I hope)
  5. Add these dependencies[1]:
        "@maven//:com_graphql_java_graphql_java",
        "@maven//:com_graphql_java_graphql_java_extended_scalars",
  1. 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.

zack-sampson avatar May 11 '22 23:05 zack-sampson

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)?

brettwooldridge avatar May 13 '22 07:05 brettwooldridge

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.

zack-sampson avatar May 16 '22 22:05 zack-sampson

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.

hobofan avatar Jun 21 '22 13:06 hobofan