79738583

Date: 2025-08-18 10:27:21
Score: 1
Natty:
Report link

I have the same problem with

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
    </parent>

This gives me the warning.

WARNING: TestEngine with ID 'junit-vintage' failed to discover tests
java.lang.NoClassDefFoundError

For me, this is important because I have to run both JUnit 4 and JUnit 5 tests. And this warning makes me not able to read JUnit 4 tests.

I tried solutions from all over the internet and I found the solution from

https://youtrack.jetbrains.com/issue/IDEA-257728/TestEngine-with-ID-junit-vintage-failed-to-discover-tests-failed-to-parse-version-of-junitjunit-4.13.1

Basically, we need to add

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.junit</groupId>
            <artifactId>junit-bom</artifactId>
            <version>5.8.1</version> <!-- Adjust this with your case -->
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

And don't forget to make the build plugin just like this

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.1.2</version>
            </plugin>

This makes me able to run both JUnit 4 and JUnit 5 tests 👍

Hope you all don't waste your time like I did. Spent like all day for this 😅

Reasons:
  • Blacklisted phrase (1): I have the same problem
  • Whitelisted phrase (-2): I found the solution
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the same problem
  • Low reputation (1):
Posted by: Muhammad Aulia Adil Murtito