我的Gradle依赖关系没有问题,但是当我尝试导入import cucumber.api.junit.Cucumber;
时,我得到了错误The import cucumber cannot be resolved
以下是我的Gradle文件:
apply plugin: 'java'
version = '1.0-SNAPSHOT'
dependencies {
compile group: 'info.cukes', name: 'cucumber-java', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-junit', version: '1.2.5'
compile group: 'info.cukes', name: 'cucumber-core', version: '1.2.5'
testCompile group: 'info.cukes', name: 'cucumber-picocontainer', version: '1.2.5'
compile group: 'info.cukes', name: 'cucumber-guice', version: '1.2.5'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
repositories {
mavenCentral()
}
我的跑步者班是:
package Runner;
import org.junit.runner.RunWith;
import cucumber.api.junit.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
Cucumber.options(
features = "\\src\\test\\java\\Feature",
glue = {"\\src\\main\\java\\Steps\\"},
tags = {"@ignored"},
format = {"json:target/cucumber/wikipedia.json","html:target/cucumber/wikipedia.html","pretty"}
)
public class RunnerMain {
}
当我评论@RunWith
,CucumberOptions
并删除导入,然后运行命令gradle build
时,我看不到任何错误,一切顺利。
我不知道我在这里做什么错
答案 0 :(得分:0)
用@CucumberOptions替换Cucumber.options并尝试一次