I am trying to load a schema through introspection: according to the docs I should run the following in my project root directory:
mkdir -p app/src/main/graphql/com/example/rocketreserver/ ./gradlew :app:downloadApolloSchema -Pcom.apollographql.apollo.endpoint='https://apollo-fullstack-tutorial.herokuapp.com/' -Pcom.apollographql.apollo.schema='src/main/graphql/com/example/rocketreserver/schema.json'
So, I changed it to:
mkdir -p app/src/main/graphql/com/myapp/ ./gradlew :app:downloadApolloSchema -Pcom.apollographql.apollo.endpoint='http://localhost:4000/graphql/' -Pcom.apollographql.apollo.schema='src/main/graphql/com/myapp/schema.json'
However I'm getting the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Project '.apollographql.apollo.endpoint=http' not found in root project 'MyApp'.
I've added the apollo plugin in the app level gradle file:
id("com.apollographql.apollo").version("2.3.1")
I've also registered the task like:
tasks.register("downloadSchema", com.apollographql.apollo.gradle.internal.ApolloDownloadSchemaTask.class) {
endpointUrl.set("https://localhost:4000/graphql")
schemaFilePath.set("src/main/graphql/com/myapp/schema.json")
}
I'm not sure what the error means exactly, I've searched for it, but can't find a reference or a solution.
Note: I get the same error when I try to run the exact same command given in the docs.
Turns out the command posted in the docs is wrong, it should be:
mkdir -p app/src/main/graphql/com/bangenergy/ ./gradlew :app:downloadApolloSchema -P com.apollographql.apollo.endpoint='http://localhost:4000/graphql/' -P com.apollographql.apollo.schema='src/main/graphql/com/bangenergy/schema.json'
Notice the space between -P
and com
.