I have integration tests in a separate folder (integrationTest) so I am trying to make a plugin that I can use to run them.
However I messed up the classpath somehow in a very weird way…
Normally files in resources-folder are accessible in this order;
- integrationTest/resources
- test/resources
- main/resources
- resources in dependencies
So if the same messages.properties exist in both 1 and 3, the first one will be loaded.
However, in my case the order looks like this.
- integrationTest/resources
- resources in dependencies
- test/resources
- main/resources
So in this case the properties file is loaded from a dependecny-jar before the one in main/resources…
This is my integrationTestPlugin.gradle
sourceSets {
integrationTest {
java.srcDir file(integrationTestSourceDir)
resources.srcDir file(integrationTestResourceDir)
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
}
task integrationTest(type: Test) {
useJUnitPlatform()
description = 'Runs integration test'
group = 'verification'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
include '**/*IT.class'
}
The gradle.properties
integrationTestSourceDir=src/integrationTest/java
integrationTestResourceDir=src/integrationTest/resources
Did I specify runtimeClasspath wrong?
I use v7.4.1 on Linux, if it matters.
Thanks.