我尝试使用gradle apollo s
生成我的graphql模式。因此,第一步是转到generateApolloClasses
,一切正常。它在下生成一个generateMainApolloIR
MainAPI.json
。但是/generated/source/apollo/generatedIR/main/src/main/graphql/client/backend/MainAPI.json
失败了:
generateApolloClasses
因此,它正在寻找错误的路径!这是我的gradle配置:
> java.io.FileNotFoundException: /Users/mctigg/Documents/Repositories/generated/source/apollo/generatedIR/main (Is a directory)
那么我该如何配置apollo {
nullableValueType = "javaOptional"
outputPackageName = "generated.client.backend"
}
task generateBackendSchemaJson(type: ApolloSchemaIntrospectionTask) {
url = 'src/main/graphql/client/backend/schema.graphqls'
output = 'src/main/graphql/client/backend/schema.json'
}
tasks.findByName('generateMainApolloIR').dependsOn(['generateBackendSchemaJson'])
来进行调查:
generateApolloClasses
代替
/generated/source/apollo/generatedIR/main/src/main/graphql/client/backend/
答案 0 :(得分:1)
也许您应该按如下所示设置架构文件路径:
apollo {
schemaFilePath = "/generated/source/apollo/generatedIR/main/src/main/graphql/client/backend/schema.json"
nullableValueType = "javaOptional"
outputPackageName = "generated.client.backend"
}