[ 
https://issues.apache.org/jira/browse/HADOOP-19617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18015749#comment-18015749
 ] 

Shilun Fan commented on HADOOP-19617:
-------------------------------------

[~szetszwo] I hope the following information helps you resolve the issue:

*1. Compatibility Configuration between JUnit 4 and JUnit 5*
When upgrading to JUnit 5, we often use it alongside JUnit 4. To ensure that 
JUnit 4 tests can run properly, we need to include the {{junit-vintage-engine}} 
dependency in the {{{}pom.xml{}}}. Below is a complete configuration example:
{code:java}
<dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
</dependency>
<dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
</dependency>
<dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
</dependency>
<dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-launcher</artifactId>
      <scope>test</scope>
</dependency>
<!-- Add junit-vintage-engine to ensure JUnit 4 tests run -->
<dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <scope>test</scope>
</dependency>{code}
For a detailed guide on how to migrate, I referred to a great document with 
instructions on migrating from JUnit 4 to JUnit 5: [JUnit Official Migration 
Guide|[https://docs.junit.org/current/user-guide/#migrating-from-junit4-running].]

 

*2. Maven Surefire Plugin Version Is Too Low*
Using an older version of the Maven Surefire plugin can lead to out-of-memory 
(OOM) errors, stack overflow issues, and may even cause some tests to be 
skipped. This can be resolved by upgrading the Surefire plugin. Here is a 
related PR that helped address this issue during the Hadoop version upgrade: 
[Hadoop PR#7785|https://github.com/apache/hadoop/pull/7785]. Upgrading to 
Surefire version 3.5.3 alleviated some of these issues.

 

*3. Low Version of {{junit-platform-launcher}} Causing Test Skipping Issues*
While upgrading Hive, I encountered an issue where a low version of the 
{{junit-platform-launcher}} was introduced through other dependencies, causing 
tests to be skipped. The solution to this problem is to exclude these outdated 
dependencies. We can refer to this PR for details: [Hive 
PR#6001|https://github.com/apache/hive/pull/6001]

Here is the specific error message I encountered:
{code:java}
# Created at 2025-08-09T06:35:43.903
Aug 09, 2025 6:35:43 AM org.junit.platform.launcher.core.DefaultLauncher 
handleThrowable# Created at 2025-08-09T06:35:43.903
WARNING: TestEngine with ID 'junit-jupiter' failed to discover tests# Created 
at 2025-08-09T06:35:43.903
org.junit.platform.commons.JUnitException: OutputDirectoryProvider not 
available; probably due to unaligned versions of the junit-platform-engine and 
junit-platform-launcher jars on the classpath/module path.# Created at 
2025-08-09T06:35:43.903
    at 
org.junit.platform.engine.EngineDiscoveryRequest.getOutputDirectoryProvider(EngineDiscoveryRequest.java:94)
 {code}
If this doesn't resolve your issue, feel free to leave me a message, and I'll 
respond as soon as I see it.

> [JDK17] Remove JUnit4 Dependency
> --------------------------------
>
>                 Key: HADOOP-19617
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19617
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Shilun Fan
>            Assignee: Shilun Fan
>            Priority: Major
>              Labels: pull-request-available
>
> Due to the extensive JUnit4 dependencies in the Hadoop modules, we will 
> attempt to remove JUnit4 dependencies on a module-by-module basis.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to