joreilly / PeopleInSpace

Kotlin Multiplatform sample with SwiftUI, Jetpack Compose, Compose for Wear, Compose for Desktop, and Compose for Web clients along with Ktor backend.
Apache License 2.0
2.98k stars 261 forks source link

Possible Gradle Plugin Error due to JDK variant incompatibility with transitive deps #320

Open solvingj opened 10 months ago

solvingj commented 10 months ago

I'm new to this project and ecosystem, so apologies in advance if it's my own environment that's causing this.

I cloned the project on my intel mac Sonoma with JDK 11, opened with latest version of Jetbrains Fleet and got the errors below.

Based on the error, I don't think my version of JDK matters, but just to try something, I installed JDK 17 then closed everything and tried again. Got the same errors.

If it's a real case where some "latest version of a transitive dependency" specifies a real incompatibility, consider adding "lockfiles" so the samples always work.

<-------------> 0% CONFIGURING [290ms]
> root project > Resolve dependencies of :classpath

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'PeopleInSpace'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve app.cash.sqldelight:gradle-plugin:2.0.1.
     Required by:
         project : > app.cash.sqldelight:app.cash.sqldelight.gradle.plugin:2.0.1
      > No matching variant of app.cash.sqldelight:gradle-plugin:2.0.1 was found. The consumer was configured to find a library for use during runtime, compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.4' but:
          - Variant 'apiElements' capability app.cash.sqldelight:gradle-plugin:2.0.1 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 11
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.4')
          - Variant 'runtimeElements' capability app.cash.sqldelight:gradle-plugin:2.0.1 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally:
bolt-daniil-popov commented 9 months ago

Hello, @solvingj! I got the same issue but solved it by using Java 17 which is required by the plugin.