Task 'generateApolloSources' not found in root project

871 views Asked by At

I am using apollo graphql client in java code. My gradle file is

plugins {
    id 'org.springframework.boot' version '2.2.6.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'java'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
     maven {
        url 'http://dl.bintray.com/apollographql/android'
    }
}

dependencies {
    implementation "com.apollographql.apollo:apollo-android-support:1.0.0"
    implementation "com.apollographql.apollo:apollo-runtime:1.0.0"
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}

test {
    useJUnitPlatform()
}

I have followed the docs mentioned in https://github.com/apollographql/apollo-android I got stuck at step 4 and 5. Not able to add

  generateKotlinModels.set(false)
}

in gradle file and while executing the command gradlew generateApollo its getting error as Task 'generateApolloSources' not found in root project 'testProject'

Could anyone please help

1

There are 1 answers

0
mbonnin On

You will need to apply the Apollo plugin:

plugins {
    id 'org.springframework.boot' version '2.2.6.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'java'
    id 'com.apollographql.apollo' version '2.1.0'
}

You should also bump the Apollo dependencies to '2.1.0' as '1.0.0' is pretty old.