1

I can't figure out how to use the gradlew command to convert my GraphQL schema into a JSON file as it is specified in the documentation.

I opened CMD in my project folder, ran the gradlew command once, and it gave me this error:

Project 'module' not found in root project gradlew

I created a module inside my project with the name "module" and now it's throwing the following error:

Task 'downloadApolloSchema' not found in project ':module'.

I've already added all the dependencies to the latest version (2.0.0 as of the time of posting) so I'm clueless as to why this is happening. I've already searched the web and found nothing about this...

This is the command I'm trying to issue in the CMD:

C:\Users\myuser\AndroidStudioProjects\GraphQLApp\app>..\gradlew :module:downloadApolloSchema -Pcom.apollographql.apollo.endpoint=https://graphql-udemy-android.herokuapp.com/graphql -Pcom.apollographql.apollo.schema=src/main/graphql/com/example/schema.json

I have to go up one directory (..\) since the gradlew command is in the above my app folder.

I'm on Windows, and my Gradle version is 6.4.

Daniel Bertoldi
  • 359
  • 4
  • 14

3 Answers3

4

You just change ./gradlew to .\gradlew

  1. Open the root terminal
  2. Paste the code below and ENTER!

.\gradlew downloadApolloSchema --endpoint=https://Your Endpoint/graphql --schema=app/src/main/graphql/com/example/Your Path/schema.json

Have a good days!

2

Sorry about that, the module part was mostly a placeholder for the gradle module where you apply the com.apollographql.apollo plugin. You can ignore it and gradle will find the appropriate task:

./gradlew downloadApolloSchema

This has been updated in the project README as well.

mbonnin
  • 6,893
  • 3
  • 39
  • 55
0

For windows i used

.\gradlew downloadApolloSchema --endpoint="https://rickandmortyapi.com/graphql" --schema=app/src/main/graphql/GetRepositories.json

NOTICE I used: .\ instead of ./

Branddd
  • 78
  • 12