确保我的自定义Gradle配置获得所需的依赖项

时间:2015-09-26 19:45:57

标签: gradle

我已在 gradle 中设置了集成测试任务,如下所示:

sourceSets {

    main {
        output.resourcesDir = output.classesDir
    }

    integrationTest {
        java.srcDirs = ['src/it/java']
        resources.srcDirs = ['src/it/resources', 'src/main/resources']
        compileClasspath = sourceSets.main.output + configurations.testRuntime
        runtimeClasspath = output + compileClasspath
    }
}

   task integrationTest(type: Test) {
        description "Run the integration tests."
        testClassesDir = sourceSets.integrationTest.output.classesDir
        classpath = sourceSets.integrationTest.runtimeClasspath
        reports.html.destination = file("$reports.html.destination/integration")
        reports.junitXml.destination = file("$reports.junitXml.destination/integration")
    }

但是当我尝试查看这些配置的依赖关系(例如integrationTestCompileintegrationTestRuntime)时,它们似乎是空的:

./gradlew bignibou-server:dependencies

integrationTest
No dependencies

integrationTestCompile - Compile classpath for source set 'integration test'.
No dependencies

integrationTestRuntime - Runtime classpath for source set 'integration test'.
No dependencies

我不确定如何指定 integrationTest 依赖项..

这不起作用:

// Testing
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.springframework.security:spring-security-test:${springSecurityVersion}")
testCompile("org.mockito:mockito-core:${mockitoVersion}")
testCompile("org.hamcrest:hamcrest-core:${hamcrestVersion}")
testCompile("org.easytesting:fest-assert:${festVersion}")
testCompile("com.h2database:h2:${h2Version}")
testCompile("org.subethamail:subethasmtp:${wiserVersion}")

否则依赖关系会出现在上面。

有人可以帮忙吗?

0 个答案:

没有答案