Java 如何使用gradle对来自另一个子项目的web项目运行集成测试

Java 如何使用gradle对来自另一个子项目的web项目运行集成测试,java,gradle,build.gradle,gretty,Java,Gradle,Build.gradle,Gretty,我有一个gradle多项目,其中我的war文件构建在一个子项目中,我的集成测试在另一个子项目中。我已经读到gretty应该能够启动jetty实例,让我在构建过程中运行集成测试,但我不知道如何将gretty integrationTestTask任务“连接”到另一个子项目中的任务,从中运行实际测试 我的项目结构如下所示: root/ int-test/ build.gradle web/ build.gradle build.gradle

我有一个gradle多项目,其中我的war文件构建在一个子项目中,我的集成测试在另一个子项目中。我已经读到gretty应该能够启动jetty实例,让我在构建过程中运行集成测试,但我不知道如何将gretty integrationTestTask任务“连接”到另一个子项目中的任务,从中运行实际测试

我的项目结构如下所示:

root/
    int-test/
        build.gradle
    web/
        build.gradle
    build.gradle
    settings.gradle
文件内容 root/settings.gradle:

include ':web'
include ':int-test'
root/build.gradle:

apply plugin: 'java'
apply plugin: 'war'
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'

gretty {
    contextPath = '/'
    integrationTestTask = 'intTests'
}

task intTests << {
    println 'This task will run in just the right time'
}
apply plugin: 'java'

task intTests << {
    println 'All integration testing is done in here'
}
root/web/build.gradle:

apply plugin: 'java'
apply plugin: 'war'
apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'

gretty {
    contextPath = '/'
    integrationTestTask = 'intTests'
}

task intTests << {
    println 'This task will run in just the right time'
}
apply plugin: 'java'

task intTests << {
    println 'All integration testing is done in here'
}
apply插件:“war”
申请地点:'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin'
格雷蒂{
contextPath='/'
integrationTestTask='intTests'
}

任务intTests首先,检查
gretty.integrationTestTask=“:int-test:intTests”
是否有效。如果没有,请将以下内容添加到
int tests/build.gradle

intTests {
    dependsOn(":web:taskThatStartsTheWebServer")
    finalizedBy(":web:taskThatStopsTheWebServer")
}
(您可以在Gretty文档或
gradle tasks
的输出中找到任务名称)


请注意,它是
task foo{dependsOn“bar”}
,而不是
task foo我有类似的问题,并尝试应用建议的解决方案,但没有成功。生成将挂起appStart任务,并且不执行任何测试。有什么建议我做错了什么?