Skip to content

Commit 0598295

Browse files
committed
Exclude JUnit 4 from Hadoop dependencies in HDFS module
The HDFS tests were failing on CI with NoClassDefFoundError for org.junit.Assert because Hadoop dependencies were bringing in JUnit 4 as a transitive dependency. Since we've migrated to JUnit 5, we need to exclude JUnit 4 from all Hadoop dependencies to prevent classpath conflicts. Changes: - Added JUnit 4 exclusions to hadoop-hdfs-client dependency - Added JUnit 4 exclusions to hadoop-common dependency (both regular and test-jar) - Added JUnit 4 exclusions to hadoop-hdfs dependency (both regular and test-jar) This ensures that only JUnit 5 (Jupiter) is on the classpath during test execution. Note: The HDFS module has a pre-existing Maven dependency resolution issue on some environments that prevents compilation. This is unrelated to the JUnit migration and exists on the master branch.
1 parent 059e6d1 commit 0598295

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

commons-vfs2-hdfs/pom.xml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,35 @@
4141
<dependency>
4242
<groupId>org.apache.hadoop</groupId>
4343
<artifactId>hadoop-hdfs-client</artifactId>
44+
<exclusions>
45+
<exclusion>
46+
<!-- Exclude JUnit 4 - we use JUnit 5 -->
47+
<groupId>junit</groupId>
48+
<artifactId>junit</artifactId>
49+
</exclusion>
50+
</exclusions>
4451
</dependency>
4552
<dependency>
4653
<groupId>org.apache.hadoop</groupId>
4754
<artifactId>hadoop-common</artifactId>
55+
<exclusions>
56+
<exclusion>
57+
<!-- Exclude JUnit 4 - we use JUnit 5 -->
58+
<groupId>junit</groupId>
59+
<artifactId>junit</artifactId>
60+
</exclusion>
61+
</exclusions>
4862
</dependency>
4963
<dependency>
5064
<groupId>org.apache.hadoop</groupId>
5165
<artifactId>hadoop-hdfs</artifactId>
66+
<exclusions>
67+
<exclusion>
68+
<!-- Exclude JUnit 4 - we use JUnit 5 -->
69+
<groupId>junit</groupId>
70+
<artifactId>junit</artifactId>
71+
</exclusion>
72+
</exclusions>
5273
</dependency>
5374
<dependency>
5475
<groupId>org.apache.logging.log4j</groupId>
@@ -81,18 +102,30 @@
81102
<exclusion>
82103
<!-- VFS-606 - tools.jar not available in Java 9
83104
This exclusion can be removed after upgrading Hadoop
84-
to 2.7.1 or later
105+
to 2.7.1 or later
85106
-->
86107
<groupId>jdk.tools</groupId>
87108
<artifactId>jdk.tools</artifactId>
88109
</exclusion>
110+
<exclusion>
111+
<!-- Exclude JUnit 4 - we use JUnit 5 -->
112+
<groupId>junit</groupId>
113+
<artifactId>junit</artifactId>
114+
</exclusion>
89115
</exclusions>
90116
</dependency>
91117
<dependency>
92118
<groupId>org.apache.hadoop</groupId>
93119
<artifactId>hadoop-hdfs</artifactId>
94120
<type>test-jar</type>
95121
<scope>test</scope>
122+
<exclusions>
123+
<exclusion>
124+
<!-- Exclude JUnit 4 - we use JUnit 5 -->
125+
<groupId>junit</groupId>
126+
<artifactId>junit</artifactId>
127+
</exclusion>
128+
</exclusions>
96129
</dependency>
97130
<dependency>
98131
<groupId>org.mockito</groupId>

0 commit comments

Comments
 (0)