I am working on a Kotlin library for my team, and I split it into multiple artifacts (based on vendors) so if we use only products from not all the vendors, we wouldn’t need to depend on everything. I include the library from maven via jitpack. However, the artifact based on the Kauai library fails each time I run, thus all following artifacts aren’t built. I have tried including the Kauai library in multiple ways, including the way libraries are included in robot code projects (wpi.deps.vendor.java()
), and the basic gradle way (manually adding the repository and dependency artifact).
The error/stack trace in the jitpack log:
* What went wrong:
Execution failed for task ':kauai:compileKotlin'.
> Could not resolve all files for configuration ':kauai:compileClasspath'.
> Could not resolve com.kauailabs.navx.frc:navx-java:3.1.413.
Required by:
project :kauai
> Unable to find a matching variant of com.kauailabs.navx.frc:navx-java:3.1.413:
- Variant 'apiElements' capability com.kauailabs.navx.frc:navx-java:3.1.413:
- Incompatible attribute:
- Required org.gradle.jvm.version '8' and found incompatible value '11'.
- Other attributes:
- Found org.gradle.category 'library' but wasn't required.
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Required org.gradle.libraryelements 'classes' and found compatible value 'jar'.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Required org.jetbrains.kotlin.platform.type 'jvm' but no value provided.
- Variant 'runtimeElements' capability com.kauailabs.navx.frc:navx-java:3.1.413:
- Incompatible attribute:
- Required org.gradle.jvm.version '8' and found incompatible value '11'.
- Other attributes:
- Found org.gradle.category 'library' but wasn't required.
- Required org.gradle.dependency.bundling 'external' and found compatible value 'external'.
- Required org.gradle.libraryelements 'classes' and found compatible value 'jar'.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-runtime'.
- Required org.jetbrains.kotlin.platform.type 'jvm' but no value provided.
What I do as a workaround is unlink the artifact and build everything else, then relink it. However, it’s a very inconvenient method.
My main theory for the reason it is failing is that the Kauai lib is Java 11, and Kotlin compiles into Java 8 bytecode, and that causes the error. Is there a way to fix this?
The library repo is here.