How to use JUnit 5.2 BOM in Maven dependency?
The following worked for me using surefire.plugin.version 2.22.2
junit-jupiter artifact brings in all other necessary artifacts, individual direct dependencies are not needed in this case.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.5.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<!--Optional: Supports running Junit4 along with Junit5 -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Referencing a bom file under <dependencyManagement><dependencies>
only manages versions to be compatible. You still need to declare all needed dependencies under <dependencies>
but without <version>
. Thats how Maven bom references work. IntelliJ can handle them that way too.