Hi,
I’ve got a custom configuration for a functional test suite that I am applying to a war project as follows:
apply from: "$rootDir/gradle/apiFunctionalTest.gradle"
The task compiles and runs the code as expected with gradle but when I refresh the gradle view in Intelij, none of the external dependencies get pulled into the IDE and hence won’t compile in intellij. I’m wondering if there is something wrong with my configuration or if intellij cannot recognise external dependencies for custom configurations?
When I change the dependencies from ‘apiFunctionalTestCompile’ to ‘testCompile’ as follows injellij does pick up the dependencies but I suspect that this is applying the external dependencies to the projects main testCompile configuration?
dependencies {
testCompile 'com.jayway.restassured:rest-assured:1.7.2'
testCompile 'org.apache.pdfbox:pdfbox:1.2.1'
testCompile 'org.seleniumhq.selenium:selenium-java:2.16.0'
testCompile 'net.sourceforge.htmlunit:htmlunit:2.9'
testCompile 'org.jsoup:jsoup:1.6.3'
testCompile libs.jackson
}
Full configuration:
sourceSets {
apiFunctionalTest {
java.srcDir file('src/apiFunctional/java')
resources.srcDir file('src/apiFunctional/resources')
compileClasspath = sourceSets.main.output + sourceSets.test.output + configurations.apiFunctionalTestCompile
runtimeClasspath = output + compileClasspath + configurations.apiFunctionalTestRuntime
}
}
configurations {
apiFunctionalTestCompile.extendsFrom testCompile
apiFunctionalTestRuntime.extendsFrom testRuntime
}
dependencies {
apiFunctionalTestCompile 'com.jayway.restassured:rest-assured:1.7.2'
apiFunctionalTestCompile 'org.apache.pdfbox:pdfbox:1.2.1'
apiFunctionalTestCompile 'org.seleniumhq.selenium:selenium-java:2.16.0'
apiFunctionalTestCompile 'net.sourceforge.htmlunit:htmlunit:2.9'
apiFunctionalTestCompile 'org.jsoup:jsoup:1.6.3'
apiFunctionalTestCompile libs.jackson
}
task apiFunctionalTest(type: Test) {
description = 'Runs the api functional(java) tests.'
group = 'verification'
testClassesDir = sourceSets.apiFunctionalTest.output.classesDir
classpath = sourceSets.apiFunctionalTest.runtimeClasspath
reports.junitXml.destination = "$buildDir/reports/functional/xml"
reports.html.destination = file("$buildDir/reports/functional/html")
}