IDEA 2019.2.2 (Ultimate Edition) requires junit-vintage-engine for Maven package using only JUnit5

Answered

I'm using IDEA 2019.2.2 (Ultimate Edition) with a pom.xml that only has JUnit5 dependencies.  Tests will not run when using Run/Debug Configurations > JUnit > All in package unless I include this in my pom.xml

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

Details:

IntelliJ IDEA 2019.2.2 (Ultimate Edition)
Build #IU-192.6603.28, built on September 6, 2019
Runtime version: 11.0.3+12-b304.56 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 7 6.1
GC: ParNew, ConcurrentMarkSweep
Memory: 4029M
Cores: 8
Registry: compiler.automake.allow.when.app.running=true
Non-Bundled Plugins: Batch Scripts Support, CMD Support, Insert Final Modifier, Lombook Plugin, MyBatisLogPlugin, String Manipulation, google-java-format, com.atlassian.bitbucket.references, ink.organics.pojo2json, io.codearte.props2yaml, io.protostuff.protostuff-jetbrains-plugin, liwey.Json2PojoWithLombok, mobi.hsz.idea.gitignore, cn.wuzhizhan.plugin.mybatis, MavenRunHelper, com.intellij.plugin.adernov.powershell, Pythonid, com.vladsch.idea.multimarkdown, org.sonarlint.idea

 

The issue is similar to what's noted here: https://stackoverflow.com/questions/52602351/junit-5-disabled-is-ignored

I've tried running both from right-clicking a class and from Run/Debug Configurations > JUnit > All in package and both have the issue.

Relevant pom section:

<build>


<plugins>
<plugin>
<!-- ======================================== -->
<!-- Runs UNIT tests (not INTEGRATION tests). -->
<!-- ======================================== -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- Junit5 need 2.22.0 or newer: https://issues.apache.org/jira/browse/SUREFIRE-1330 -->
<version>2.22.0</version>
...
</plugin>

<dependencies>
...
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<!-- don't force child-projects to use our libs so set it to compile scope -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<!-- this is needed or IntelliJ gives junit.jar or junit-platform-launcher:1.3.2 not found errors -->
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<!-- this is needed or IntelliJ can't run from Run/Debug configs where you pick "JUnit" as the type -->
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

 

Also I can't run tests via right-clicking a test unless I have this in my pom.xml (or manually add it to my path):

 <dependency>
<!-- this is needed or IntelliJ gives junit.jar or junit-platform-launcher:1.3.2 not found errors -->
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
0
3 comments

Anthony, can you please create an issue at YouTrack (https://youtrack.jetbrains.com) providing the little sample project where you experience the problem. Thank you  

0
Avatar
Permanently deleted user

https://youtrack.jetbrains.com/issue/IDEA-231927 for the junit-platform-launcher issue

0
Avatar
Permanently deleted user

FYI. I cannot reproduce the other error mentioned here (unable to run all tests in package)

0

Please sign in to leave a comment.