如何让gradle和黄瓜一起工作? [英] How to get gradle and cucumber working together?
问题描述
让gradle与黄瓜干净地工作是一个挑战。我想得到 gradle build
来编译和运行测试,但到目前为止我没有成功。
Getting gradle to work with cucumber cleanly is something of a challenge. I want to get gradle build
to compile and run the tests, but so far I've had no success.
plugins {
id "com.github.samueltbrown.cucumber" version "0.9"
}
apply plugin: 'java'
apply plugin: 'idea'
def JAVA_WEBSOCKET_VERSION = '1.2.1'
def CUCUMBER_VERSION = '1.2.4'
jar {
manifest {
attributes 'Implementation-Title': 'Java-WebSocket',
'Implementation-Version': JAVA_WEBSOCKET_VERSION
}
}
repositories {
jcenter()
}
dependencies {
testCompile "info.cukes:cucumber-java:$CUCUMBER_VERSION"
testCompile "info.cukes:cucumber-junit:$CUCUMBER_VERSION"
testCompile 'junit:junit:4.+'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
}
我收到许多关于注释的错误( @Given
, @Then
, @After
),黄瓜使用。我想要的是干净地构建项目,而不使用JavaExec。这是可能的还是对防止这种情况的gradle或黄瓜有特定的限制?
Currently I get many errors about the annotations (@Given
, @Then
, @After
) that cucumber uses. What I want is to build the project cleanly without using JavaExec. Is this possible or is there a specific limitation to either gradle or cucumber that prevents this?
推荐答案
请使用以下gradle cucumber插件在您的 build.gradle 文件
Please use the below gradle cucumber plugin in your build.gradle file
插件{
id'java'
idcom.github.samueltbrown。黄瓜版本0.9
}
plugins { id 'java' id "com.github.samueltbrown.cucumber" version "0.9" }
dependencies {
testCompile group:'junit',name:'junit',version:'4.11'
compile'org.codehaus.groovy:groovy:2.4.7'
cucumberCompile'info.cukes:cucumber-groovy:1.2.2'
}
dependencies { testCompile group: 'junit', name: 'junit', version: '4.11' compile 'org.codehaus.groovy:groovy:2.4.7' cucumberCompile 'info.cukes:cucumber-groovy:1.2.2' }
在终端机中运行 gradle cucumber 可让您开始
Running gradle cucumber in the terminal will get you started
这篇关于如何让gradle和黄瓜一起工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!