Hi,
I have a projet that has test and integration tests that are in separate dir. A “gradle build” works fine. but when I import the project in Eclipse (2020-03) using Buildship (3.1.5.v20210113-0929), eclipse is not resolving the JUnit 5 classes and some of the Spring Cloud binder-test dependencies.
To bypass this I endup putting all the tests dependencies to Implement and not testImplementation or integrationImplementation.
Here is the part from my build.gradle where the integration test are defined:
sourceSets {
test {
java.srcDirs = [‘src/test/java’]
}
integration {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}configurations {
compileOnly {
extendsFrom annotationProcessor
}
integrationImplementation.extendsFrom testImplementation
integrationRuntimeOnly.extendsFrom runtimeOnly
}task integration(type: Test) {
useJUnitPlatform()
description = ‘Runs integration tests.’
group = ‘verification’testClassesDirs = sourceSets.integration.output.classesDirs classpath = sourceSets.integration.runtimeClasspath shouldRunAfter test
}
check.dependsOn integration
and the dependencies for the project
integrationImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' } integrationImplementation 'com.github.tomakehurst:wiremock-jre8:2.27.2' integrationImplementation 'org.springframework.cloud:spring-cloud-stream-test-support' integrationImplementation("org.springframework.cloud:spring-cloud-stream") { artifact { name = "spring-cloud-stream" extension = "jar" type = "test-jar" classifier = "test-binder" } } integrationImplementation 'com.desjardins.gpapdspcommons:gpap-contract:latest.integration'
Project structure and classe example that is not compiling.
Any idea how to solve this ? Tried many things with no solution.