graphql-java-generator / graphql-gradle-plugin-project

graphql-gradle-plugin is a Gradle Plugin for GraphQL, based on graphql-java. It accelerates the development for both the client and the server, by generating the Java code. It allows a quicker development when in contract-first approach, by avoiding to code the boilerplate code.
https://graphql-maven-plugin-project.graphql-java-generator.com/
MIT License
54 stars 8 forks source link

FileNotFoundException is throw during the project build task #13

Closed gilb77 closed 1 year ago

gilb77 commented 1 year ago

When I upgraded the plugin to version 1.18.6, the task generateGraphQLSchema threw a FileNotFoundException exception because the specified directory '/generated-resources/graphql-maven-plugin_generate-relay-schema' does not exist, but the build.gradle doesn't define this task, so it should not run. I suspect it happens during Gradle configuration step.

It's important to emphasize that we have only generateClientCodeConf configuration block and no generateGraphQLSchema section at all, and the failure is during the project build task while running the generate code task explicitly work fine

generateClientCodeConf {
    schemaFileFolder = '../../../project/src/main/resources'
    packageName = 'com.myproject.gql.client.project'
    // The parameters below change the 1.x default behavior. They are set to respect the default behavior of the future 2.x versions
    generateDeprecatedRequestResponse = false
    separateUtilityClasses = true
    templates = [
        OBJECT: "./src/main/resources/gql/templates/object_type.vm.java"
    ]
    customScalars = [
            [
                    graphQLTypeName: "DateTime",
                    javaType: "java.time.OffsetDateTime",
                    graphQLScalarTypeStaticField: "graphql.scalars.datetime.DateTimeScalar.INSTANCE"
            ]
    ]
}

It passes if we run just generateClientCode, so I think the only problem is that the task generateGraphQLSchema has to be skipped.

From version 1.18.6, a dependency was added for the compileJava and processResources tasks in the plugin.

The exception: 2023-01-25T11:26:43.961+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2023-01-25T11:26:43.961+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception. 2023-01-25T11:26:43.961+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2023-01-25T11:26:43.961+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] What went wrong: 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] A problem was found with the configuration of task ':services:myproject:shared:client:project:generateGraphQLSchema' (type 'GenerateGraphQLSchemaTask'). 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Type 'com.graphql_java_generator.gradleplugin.GenerateGraphQLSchemaTask' property 'targetFolder' specifies directory '/generated-resources/graphql-maven-plugin_generate-relay-schema' which doesn't exist. 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Reason: An input file was expected to be present but it doesn't exist. 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Possible solutions: 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 1. Make sure the directory exists before the task is called. 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2. Make sure that the task which produces the directory is declared as an input. 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Please refer to https://docs.gradle.org/7.0.1/userguide/validation_problems.html#input_file_does_not_exist for more details about this problem. 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
Try: 2023-01-25T11:26:43.962+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --scan to get full insights. 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Exception is: 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] org.gradle.internal.execution.WorkValidationException: A problem was found with the configuration of task ':services:myproject:shared:client:project:generateGraphQLSchema' (type 'GenerateGraphQLSchemaTask'). 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Type 'com.graphql_java_generator.gradleplugin.GenerateGraphQLSchemaTask' property 'targetFolder' specifies directory '/generated-resources/graphql-maven-plugin_generate-relay-schema' which doesn't exist. 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Reason: An input file was expected to be present but it doesn't exist. 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Possible solutions: 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 1. Make sure the directory exists before the task is called. 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2. Make sure that the task which produces the directory is declared as an input. 2023-01-25T11:26:43.963+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Please refer to https://docs.gradle.org/7.0.1/userguide/validation_problems.html#input_file_does_not_exist for more details about this problem. 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.build(WorkValidationException.java:109) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.WorkValidationException$BuilderWithSummary.get(WorkValidationException.java:91) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:97) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:50) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:86) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:32) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43) 2023-01-25T11:26:43.964+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.withWorkspace(ExecuteActionsTaskExecuter.java:283) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:49) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:35) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:184) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173) 2023-01-25T11:26:43.965+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109) 2023-01-25T11:26:43.966+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46) 2023-01-25T11:26:43.966+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51) 2023-01-25T11:26:43.966+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57) 2023-01-25T11:26:43.966+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56) 2023-01-25T11:26:43.966+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36) 2023-01-25T11:26:43.966+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77) 2023-01-25T11:26:43.966+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55) 2023-01-25T11:26:43.966+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52) 2023-01-25T11:26:43.967+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200) 2023-01-25T11:26:43.967+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195) 2023-01-25T11:26:43.967+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75) 2023-01-25T11:26:43.967+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68) 2023-01-25T11:26:43.967+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153) 2023-01-25T11:26:43.967+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68) 2023-01-25T11:26:43.967+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62) 2023-01-25T11:26:43.967+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76) 2023-01-25T11:26:43.968+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54) 2023-01-25T11:26:43.968+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76) 2023-01-25T11:26:43.968+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52) 2023-01-25T11:26:43.968+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74) 2023-01-25T11:26:43.968+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:408) 2023-01-25T11:26:43.968+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:395) 2023-01-25T11:26:43.968+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:388) 2023-01-25T11:26:43.969+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:374) 2023-01-25T11:26:43.969+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127) 2023-01-25T11:26:43.969+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191) 2023-01-25T11:26:43.969+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182) 2023-01-25T11:26:43.969+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124) 2023-01-25T11:26:43.969+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) 2023-01-25T11:26:43.969+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48) 2023-01-25T11:26:43.969+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56) 2023-01-25T11:26:43.970+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2023-01-25T11:26:43.970+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 2023-01-25T11:26:43.970+0200 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org 2023-01-25T11:26:43.970+0200 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] 2023-01-25T11:26:43.970+0200 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 23s

etienne-sf commented 1 year ago

Thanks for the detailed report

Did you achieve a build, or are you stuck with this issue ?

gilb77 commented 1 year ago

Yes we stuck, the Gradle build failed because generateGraphQLSchema throws an exception

gilb77 commented 1 year ago

@etienne-sf Do you have any updates about the issue?

etienne-sf commented 1 year ago

Not yet.

At first, I couldn't repeat it. I'm finishing some other stuff, and I'll get back to this one.

etienne-sf commented 1 year ago

Hello,

I did a new test today, and I was not able to repeat it. I've updated the gradle client tutorial back to release 1.18.6, as yours.

Can you test it, and confirm the build is ok for you ? please try both the gradle wrapper, and your gradle version

Etienne

etienne-sf commented 1 year ago

Any update on this issue ?

If it's still an issue, can you provide the gradle build file ?

gilb77 commented 1 year ago
  1. We use Gradle version 7.0.1
  2. We use the same version 1.18.6 in the plugin com.graphql_java_generator.graphql-gradle-plugin and in the dependency graphql-java-server-dependencies.

I can't provide the Gradle build file because we use it in our organization,

But I can provide the part we config the plugin in the Gradle file.

Another option is to take it in a session and I will show you the problem.

gilb77 commented 1 year ago

@etienne-sf any update?

etienne-sf commented 1 year ago

Sorry, I missed your message.

Yes, if you can provide the part of the gradle build file for the plugin, I'll probably be able to repeat, then correct it.

Etienne

etienne-sf commented 1 year ago

Closed, as I could not repeat this issue.

It can be reopened, of course. But please provide enough information.