bitcoinj / secp256k1-jdk

Java library providing Bitcoin-related Elliptic Curve Cryptography
Apache License 2.0
8 stars 3 forks source link

Build of Kotlin examples fails on NixOS: #93

Open msgilligan opened 3 days ago

msgilligan commented 3 days ago

build gradle is failing for me on NixOS, both in my home-manager shell and in a nix develop shell.

The error is:

> Task :secp-examples-kotlin:compileKotlin FAILED
e: No class roots are found in the JDK path: /nix/store/j4miw9k22ivwmga8hibwh3cph601z2nc-openjdk-22.0.2-ga

I can work around it by installing a Gradle wrapper and using the Gradle wrapper to launch Gradle or by commenting out the Kotlin module in settings.gradle.

It seems to be related to these commented out lines in flake.nix:

(mkIf stdenv.isLinux [
       {
              name = "JAVA_HOME";
              eval = "$DEVSHELL_DIR/lib/openjdk";
       }
   ])

I think "jdk home" or "JAVA_HOME" is not being set correctly in the Kotlin plugin when a Nix-installed Gradle is being used and the correct JDK path should be (in the case of the error message above):

/nix/store/j4miw9k22ivwmga8hibwh3cph601z2nc-openjdk-22.0.2-ga/lib/openjdk
msgilligan commented 3 days ago

It's also worth noting that the Kotlin plugin version 2.0.20 says it is not compatible with Gradle 8.10 (it says 8.6 for best results, but 8.7-8.8 should also work) I haven't found Gradle 8.10 to cause problems in any other case on either macOS or Linux.