Skip to content

Show dialog if JUnit 5 plug-in test launch detects unrestricted junit-jupiter-api in plug-in dependencies #2045

@trancexpress

Description

@trancexpress

See: #2013 (comment)

In essence, we have a problem when JUnit 5 and JUnit 6 are in the target platform (which will soon be the case for the Eclipse SDK, see: eclipse-jdt/eclipse.jdt.ui#2535).

Given a MANIFEST.MF like this:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TestPlugin
Bundle-SymbolicName: TestPlugin
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.junit,
 junit-jupiter-api
Automatic-Module-Name: TestPlugin
Bundle-RequiredExecutionEnvironment: JavaSE-21

Running a JUnit 5 plug-in test launch configuration will result in an odd error in the launched JVM:

Caused by: java.util.ServiceConfigurationError: org.junit.platform.engine.TestEngine: org.junit.jupiter.engine.JupiterTestEngine not a subtype

This is due to adding JUnit 5 to the launch (we fix this in #2013), but the launch already having JUnit 6 due to the unrestricted junit-jupiter-api in the MANIFEST.MF.

We opted for aborting the launch with a specific error message, which indicates what the problem is and how to fix it.

See also the long discussion here for more context: #2013 (comment)

The problem is avoided by restricting the junit-jupiter-api version to [5,6) (thanks to #2013), which the new error should indicate.

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