0

Cucumber と Serenity を統合するために、以下の Gardle ファイルを作成しました。Serenity は正常に動作していますが、Cucumber では使用できません。@RunWith(CucumberWithSerenity.class) をランナー クラスで使用すると、未解決の型エラーが発生します。

build.gradle:

apply plugin: "java"
apply plugin: "maven"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'net.serenity-bdd.aggregator'  
apply plugin: 'com.jfrog.bintray'

group = "myorg"
version = 1.0

repositories {
    maven {

            url "http://nexus2.sdmc.ao-srv.com/content/groups/inhouse_dit/"
        }
}

buildscript {
    repositories {
        maven {

            url "http://nexus2.sdmc.ao-srv.com/content/groups/inhouse_dit/"
        }
    }

    dependencies {

        classpath("net.serenity-bdd:serenity-gradle-plugin:1.0.47")
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.6' 
    }
}

ext {
bintrayBaseUrl = 'https://api.bintray.com/maven'
bintrayRepository = 'maven'
bintrayPackage = 'serenity-cucumber'
projectDescription = 'Serenity Cucumber integration'
if (!project.hasProperty("bintrayUsername")) {
bintrayUsername = 'wakaleo'
}
if (!project.hasProperty("bintrayApiKey")) {
bintrayApiKey = ''
}
serenityCoreVersion = '1.0.49'
cucumberJVMVersion = '1.2.2'
//versionCounter = new ProjectVersionCounter(isRelease: project.hasProperty("releaseBuild"))
}

sourceSets.all { set ->
    def jarTask = task("${set.name}Jar", type: Jar) {
        baseName = baseName + "-$set.name"
        from set.output
    }

    artifacts {
        archives jarTask
    }
}

sourceSets {
    api
    impl
}

dependencies {
    apiCompile 'commons-codec:commons-codec:1.5'

    implCompile sourceSets.api.output
    implCompile 'commons-lang:commons-lang:2.6'

    compile "info.cukes:cucumber-java:${cucumberJVMVersion}"
    compile "info.cukes:cucumber-junit:${cucumberJVMVersion}"

    testCompile 'net.serenity-bdd:core:1.0.47'                          
    testCompile 'net.serenity-bdd:serenity-junit:1.0.47'                
    testCompile('junit:junit:4.11')
    testCompile('org.assertj:assertj-core:1.7.0')
    testCompile('org.slf4j:slf4j-simple:1.7.7')
    testCompile sourceSets.api.output
    testCompile sourceSets.impl.output
     testCompile 'org.codehaus.groovy:groovy-all:2.3.6'
    testCompile("org.spockframework:spock-core:0.7-groovy-2.0") {
        exclude group: "junit"
        exclude module: "groovy-all"
    }

    testCompile("com.github.goldin:spock-extensions:0.1.4") {
        exclude module: "spock-core"
        exclude module: "slf4j-api" 
    }   
    runtime configurations.apiRuntime
    runtime configurations.implRuntime
}
gradle.startParameter.continueOnFailure = true 

jar {
    from sourceSets.api.output
    from sourceSets.impl.output
    manifest {
             attributes("Implementation-Title": "Serenity Cucumber Plugin",
             "Implementation-Version": project.version.toString())
            }
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar, javadocJar
}


bintray {
user = bintrayUsername //this usually comes form gradle.properties file in ~/.gradle
key = bintrayApiKey //this usually comes form gradle.properties file in ~/.gradle
publications = ['mavenJava'] // see publications closure
pkg {
repo = 'maven'
userOrg = 'serenity'
name = 'serenity-cucumber'
desc = 'Serenity Cucumber integration'
licenses = ['Apache-2.0']
labels = ['serenity','bdd','cucumber']
}
}

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: uri("${buildDir}/repo"))

            addFilter("main") { artifact, file -> artifact.name == project.name }
            ["api", "impl"].each { type ->
                addFilter(type) { artifact, file -> artifact.name.endsWith("-$type") }

                // We now have to map our configurations to the correct maven scope for each pom
                ["compile", "runtime"].each { scope ->
                    configuration = configurations[type + scope.capitalize()]
                    ["main", type].each { pomName ->
                        pom(pomName).scopeMappings.addMapping 1, configuration, scope
                    }
                }
            }

        }
    }  

}
task wrapper (type: Wrapper) {

    gradleVersion = '2.3'

    distributionUrl = 'http://nexus2.sdmc.ao-srv.com/content/repositories/inhouse_dit_thirdparty/org/gradle/gradle-bin/2.3/gradle-2.3-bin.zip' 

}

Cucumber で静けさを実行するには、何を変更する必要があるかを提案してください。前もって感謝します。

4

2 に答える 2