Skip to content

Mix of junit4 and junit5 on classpath confuses Eclipse #2330

@iloveeclipse

Description

@iloveeclipse

@trancexpress tried to run latest JUnit tests (for #2326) inside Eclipse 4.27, got zero tests found/executed.

The reason seem to be a mix of JUnit4 / JUnit5 runtimes generated in .classpath files (but might be something related to Eclipse itself, see eclipse-pde/eclipse.pde#390) and that new Eclipse uses JUnit 5 by default.

Anyway, I see the mix is coming from different JUnit versions referenced by gradle build files:

git grep junit | grep gradle
build.gradle:    def junitVersion = '5.9.2'
build.gradle:    compileOnly platform("org.junit:junit-bom:$junitVersion")
build.gradle:    testImplementation platform("org.junit:junit-bom:$junitVersion")
build.gradle:    !it.toString().contains("-test") && !it.toString().contains("Test") && !it.toString().contains("junit")
eclipsePlugin-junit/build.gradle:  testImplementation 'junit:junit:4.13.2'
settings.gradle.kts:include(":eclipsePlugin-junit")
spotbugs-ant/build.gradle:  testImplementation 'junit:junit:4.13.2'
spotbugs-tests/build.gradle:  implementation 'junit:junit:4.13.2'
spotbugsTestCases/build.gradle:  implementation 'junit:junit:4.13.2'
test-harness-jupiter/build.gradle:  compileOnly 'org.junit.jupiter:junit-jupiter-api'
test-harness-jupiter/build.gradle:  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
test-harness-jupiter/build.gradle:  testImplementation 'org.junit.jupiter:junit-jupiter-api'
test-harness/build.gradle:  compileOnly 'junit:junit:4.13.2'

Ideally we should use one JUnit version in the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions