Don't know whether my expectation is just plain unrealistic, or whether the DGS documentation is just really incomprehensible - cos this seems simple enough, however none of what was described in works as expected; says; You can also specify external dependencies containing schemas to use for generation by declaring it as a dependency in the dgsCodegen configuration. The plugin will scan all .graphql and .graphqls files and generate those classes under the same build/generated directory. This is useful if you have external dependencies containing some shared types that you want to add to your schema for code generation. Note that this does NOT affect your project's schema, and is only for code generation. Example: dependencies { // other dependencies dgsCodegen 'com.netflix.graphql.dgs:example-schema:x.x.x' }So to work with this, I have two projects structured as follows: shared-schemas project structure shared-schemas | --- src/main/resources/schema | | | --- shared-models.graphqls | --- build.gradle | --- settings.gradleshared-schemas build.gradle plugins { id "java-library" } group = 'com.shared.library' // ... other configsshared-library settings.gradle rootProject.name = 'shared-schemas'application project structure application | --- src/main/resources/schema | | | --- application-models.graphqls | --- build.gradle | --- settings.gradleapplication build.gradle plugins { id "com.netflix.dgs.codegen" version "6.1.3" } // ... other configs dependencies { dgsCodegen 'com.shared.library:shared-schemas:0.0.1-SNAPSHOT' } generateJava { schemaPaths = ["src/main/resources/schema"] // List of directories containing schema files packageName = "com.application.graphql.schemas" // The package name to use to generate sources generateClient = true // Enable generating the type safe query API }Then I carry out the following gradle build steps; cd into shared-schemas then ./gradlew pulishToMavenLocal to install the library locally cd into application then ./gradlew clean build to build the application which references the library as a dependency. After these, the application build was successful, and GraphQL models defined inside application-models.graphqls are all created into build/generated folder. However the GraphQL models that were defined in shared-models.graphqls (within the shared-schemas library) aren't generated, and aren't inside the build/generated folder . Could someone kindly point me towards what's being done incorrectly here? (责任编辑:) |