在根项目中找不到任务'generateApolloSources'



我在java代码中使用apollo graphql客户端。我的等级文件是

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()
}

我遵循了中提到的文档https://github.com/apollographql/apollo-android我在第4步和第5步被卡住了。无法添加

generateKotlinModels.set(false)
}

在gradle文件中并且在执行命令时gradlew generatePollo的获取错误为在根项目"testProject"中找不到任务"generatePolloSources">

有人能帮吗

您需要应用Apollo插件:

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'
}

您还应该将Apollo依赖关系提升到"2.1.0",因为"1.0.0"相当旧。

最新更新