New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JUnit Jupiter 5.6.0 tests do not run with Maven Surefire and IntelliJ IDEA #2169
Comments
How did you physically upgrade your Spring Boot application to JUnit Jupiter 5.6? Did you do something similar to the following in your Maven POM? <properties>
<junit-jupiter.version>5.6.0</junit-jupiter.version>
</properties> |
No, I have explicit dependency added to the project which was using version 5.5.2 earlier
|
Attempting to override Spring Boot's dependency management via an explicit dependency declaration like that is not supported. Please see the aforementioned Stack Overflow (SO) question for further details and links to the corresponding Spring Boot documentation. In light of that, I am closing this issue; however, if you still have issues after following the advice from the SO answer, I'd recommend that you post a new question SO. Cheers |
I'm using JUnit along with Spring Boot, but without the corresponding Spring Boot parent. Simplified POM: <properties>
<spring.boot.version>2.2.4.RELEASE</spring.boot.version>
<junit-jupiter.version>5.5.2</junit-jupiter.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
</dependencies>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
</plugin>
</plugins> The setup is fine unless I bump JUnit to 5.6.0, then no tests are executed via Surefire. Is there anything else I have to configure? |
@beatngu13, could you perhaps provide us a simplified sample application that we can experiment with? |
I can reproduce it in my multi-module Maven project, but I realized it's not straightforward to do so with a minimal setup. Will try to come up with a sample project, don't bother until then. |
@prasadthotakura,, the spring boot bom is overriding some of the dependencies pulled in transitively by Jupiter. Either wait for the Spring guys to do the upgrade or use something similar to the following config in your reactor pom:
|
There was some activity about this one on twitter, see https://twitter.com/hakandamar/status/1243120351791497217 Based on that example, here is the proper way of avoiding mixed version of JUnit on the classpath: snicoll-scratches/test-junit@d5a05e2 In this particular cases, only 3 dependencies were overridden but the rest was still managed by Spring Boot. As a result the following dependencies still had the wrong versions:
Making sure consistent versions are used fixes the problem. TL;DR: do not override individual modules, this will lead to mixed versions on the classpath and unpredictable result. If you are using @lintong that example of yours is not accurate, it should use the bom instead. |
@beatngu13 you should include |
Related Maven POM/BOM quiz by @aalmiray https://twitter.com/aalmiray/status/1243119645151952897 -- I learned a lot today. |
Trying to upgrade JUnit Jupiter from 5.5.2( where everything is running fine) to 5.6.0 for Java (Spring Boot) project. Both Maven Surefire plugin (v 2.22.2) and IntelliJ IDEA (Ultimate v 2019.3) doesn't detect or run the tests
Steps to reproduce
Sample Code
Context
The text was updated successfully, but these errors were encountered: