我无法为“com.github.samueltbrown.cucumber”插件运行 cucumber 任务。
我收到以下错误:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/freid/app/build.gradle' line: 118
* What went wrong:
A problem occurred evaluating root project 'app'.
> Could not find method outputDir() for arguments [/Users/freid/app/src/cucumber/java] on cucumber Java source of type org.gradle.api.internal.file.DefaultSourceDirectorySet.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
这是我的build.gradle文件:
buildscript {
ext {
springBootVersion='2.2.4.RELEASE'
lombokVersion='1.18.4'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'org.springframework.boot' version '2.2.4.RELEASE'
id 'java'
id 'com.github.psxpaul.execfork' version '0.1.8'
id "com.jfrog.artifactory" version "4.7.2"
id "com.github.samueltbrown.cucumber" version "0.9"
}
dependencies {
testCompile 'info.cukes:cucumber-java:1.2.4'
}
sourceSets {
cucumber {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/cucumber/java')
}
resources.srcDir file('src/cucumber/resources')
}
}
cucumber {
formats = ['html:build/reports/html', 'json:build/reports/cucumber.json']
jvmOptions {
environment 'tag', System.getProperty("tag")
environment 'cucumber.local.server', 'localhost'
}
}
最佳答案
鉴于com.github.samueltbrown.cucumber
0.9版插件已于2015年发布,并且您尝试使用最新的Spring Boot版本运行,我假设您也使用了最新的Gradle版本。
因此,我相信您遇到了插件和Gradle版本之间的不兼容问题。很可能是API发生了更改,并且插件内部执行的操作不再起作用。[/Users/freid/app/src/cucumber/java]
看起来像文件集合的toString
,而SourceDirectorySet.outputDir
仅接受一个File
。因此,我的猜测是,返回使用值的API有时会从单个文件更改为文件集合。
关于java - 在类型为org.gradle.api.internal.file.DefaultSourceDirectorySet的 cucumber Java源上找不到方法outputDir(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60989445/