我正在尝试将Gradle(1.4)添加到具有多个测试套件的现有项目中.位于src/test/java成功运行的标准单元测试,但是我无法设置任务来运行位于的JUnit测试src/integration-test/java.
当我运行时,gradle intTest我得到几个cannot find symbol类的错误src/main.这让我相信依赖关系没有正确设置.如何设置intTest以便它将运行我的JUnit集成测试?
的build.gradle
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_6
sourceSets {
integration {
java {
srcDir 'src/integration-test/java'
}
resources {
srcDir 'src/integration-test/resources'
}
}
}
dependencies {
compile(group: 'org.springframework', name: 'spring', version: '3.0.7')
testCompile(group: 'junit', name: 'junit', version: '4.+')
testCompile(group: 'org.hamcrest', name: 'hamcrest-all', version: '1.+')
testCompile(group: 'org.mockito', name: 'mockito-all', version: '1.+')
testCompile(group: 'org.springframework', name: 'spring-test', version: '3.0.7.RELEASE')
integrationCompile(group: 'junit', name: 'junit', version: '4.+')
integrationCompile(group: 'org.hamcrest', …Run Code Online (Sandbox Code Playgroud)