Netflix / dgs-codegen

Apache License 2.0
176 stars 91 forks source link

gradle plugin not resolving dependencies properly #699

Open xenoterracide opened 3 weeks ago

xenoterracide commented 3 weeks ago
# libs.versions.toml
dgs-codegen = { id = "com.netflix.dgs.codegen", version = "6.+" }
// build.gradle.kts
buildscript { dependencyLocking { lockAllConfigurations() } }

plugins {
  `java-library`
  alias(libs.plugins.dgs.codegen)
}

dependencyLocking {
  lockAllConfigurations()
}

tasks.withType<GenerateJavaTask>().configureEach {
  packageName = "com.xenoterracide.controller.registration"
  language = "java"
}
Configuration cache state could not be cached: field `classpath` of task `:controller-registration:compileJava` of type `org.gradle.api.tasks.compile.JavaCompile`: error writing value of type 'org.gradle.api.internal.artifacts.configurations.DefaultUnlockedConfiguration'
> Could not resolve all files for configuration ':controller-registration:compileClasspath'.
   > Resolved 'org.jetbrains:annotations:13.0' which is not part of the dependency lock state
   > Resolved 'org.jetbrains.kotlin:kotlin-stdlib:1.9.24' which is not part of the dependency lock state
   > Resolved 'com.netflix.graphql.dgs:graphql-dgs-platform:5.5.1' which is not part of the dependency lock state
   > Resolved 'com.netflix.graphql.dgs:graphql-dgs-platform-dependencies:5.5.1' which is not part of the dependency lock state

calling dependencies --write-locks (with some output filters

     +--- com.graphql-java:graphql-java:19.2 FAILED
|    +--- com.graphql-java:graphql-java:19.2 FAILED
|    +--- com.graphql-java:graphql-java:22.0 FAILED
|    +--- com.graphql-java:graphql-java:22.1 FAILED
|    +--- com.graphql-java:graphql-java:{prefer 18.3} FAILED
|    |    +--- com.graphql-java:graphql-java:{strictly [19.2, 20[; prefer 19.2; reject 18.2} FAILED
+--- com.netflix.graphql.dgs:graphql-dgs-platform FAILED

I tried adding things like com.netflix.graphql.dgs:graphql-dgs-platform:5.5.1 to implementation but that didn't fix it.

xenoterracide commented 3 weeks ago

It would appear that I needed to add this, and that spring-boot-dependencies absolutely broke things

  implementation(platform(libs.dgs.platform.dependencies))
  implementation(libs.graphql.java)

note: those map to libs.versions.toml

dgs-platform-dependencies = { module = "com.netflix.graphql.dgs:graphql-dgs-platform-dependencies", version = "9.+" }
graphql-java = { module = "com.graphql-java:graphql-java" }

I think I tried using 5.+ first and had this problem... but I'm not certain.

could more about this please be added to the documentation? I'm fine with needing to add dependencies for the generated code but I'd like it to be documented. I'm not actually generally using DGS, was just going to use this plugin for spring-graphql.