java - 在 org.gradle.api.internal.file.DefaultSourceDirectorySet 类型的黄瓜 Java 源上找不到方法 outputDir()
问题描述
我无法为“com.github.samueltbrown.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 在某个时候从单个文件更改为文件集合。
推荐阅读
- android - 如何根据操作系统版本在 xml 中设置 ListPreference defaultValue
- html - 上传相机功能不适用于 Android 上的 MS Teams 任务模块
- python - 使用 bs4 抓取 marketwatch.com 时出现“NoneType”错误
- git - git:删除嫁接的分支
- r - 无法在 Google Cloud 上安装最新的 R 版本
- anylogic - 将行人代理位置存储在 txt 中
- ios - QuickLook/QLPreviewController PDF Text Annotation 背景变黑,字体变小
- python - Python-在另一个df中查找单元格值,将布尔值返回到另一个单元格
- memory-management - 如何恢复页面错误处理程序
- c# - 解析iperf结果