maven-surefire icon indicating copy to clipboard operation
maven-surefire copied to clipboard

remove junit 3 provider code

Open olamy opened this issue 7 months ago • 12 comments

New feature, improvement proposal

junit before 4.12 is not supported anymore see https://github.com/junit-team/junit-framework/issues/1560

olamy avatar Sep 23 '25 10:09 olamy

Does it mean that Using POJO Tests would also go? I'm not sure - but I think JU3 is used for that.

pzygielo avatar Sep 23 '25 10:09 pzygielo

Does it mean that Using POJO Tests would also go? I'm not sure - but I think JU3 is used for that.

sure will be removed as well see #3187

olamy avatar Sep 23 '25 12:09 olamy

I would almost argue to also remove JUnit 4

Bukama avatar Sep 24 '25 08:09 Bukama

JUnit 3 still works and is still widely used, including in some of Maven's own code. This just seems likely t impose a lot of needless churn on users.

elharo avatar Oct 07 '25 18:10 elharo

JUnit 3 still works and is still widely used, including in some of Maven's own code. This just seems likely t impose a lot of needless churn on users.

as said on mailing list you are free to lock the surefire plugin version to the last one supporting junit3, If you are using a very old dependency such junit 3.8 you can certainly lock surefire version to 3.5.4. Nobod is forcing you to upgrade. pluginManagement/dependencyManagement are here for a reason

olamy avatar Oct 08 '25 04:10 olamy

I disagree. Any open source project experiences a constant stream of random people shouting to upgrade because, well, just because. This is an example of that. There's no particular reason to drop JUnit 3 here, or anywhere, except that some people like bigger numbers.

elharo avatar Oct 08 '25 11:10 elharo

The reason is that keeping JUnit 3 is costly: it makes new developments more difficult. I tried to work on a new feature last Saturday (test the different versions of a multi-release project), and stopped in wait for Surefire simplification.

desruisseaux avatar Oct 08 '25 12:10 desruisseaux

@elharo In that case, nothing prevents you from using pluginManagement to enforce the last version of the Surefire plugin that still supports this setup. Since users relying on such configurations are already stuck with an old JUnit 3.x version, they can just as well be locked to a compatible Surefire version too. As far as I know, this is precisely what dependencyManagement and pluginManagement are meant for. On the other hand, we really need to stop doing “archaeological code collection.” JUnit 3 is no longer supported and won’t receive any updates. So just stick to the Surefire version that supports it. The same goes for plain POJO tests, unless someone wants to go through the effort of writing a custom JUnit Platform engine. But honestly, in 2025, I really wonder who’s still using that… As @Martin Desruisseaux mentioned here, maintaining backward compatibility comes at a cost. A few months ago, I fixed issues related to multi-threaded tests with JUnit 5, and we still maintain multiple report listener implementations (for JUnit 3, 4, 5, and TestNG). The current interface isn’t well suited for multi-threaded execution and would need significant refactoring which is a lot of code to touch (every single providers). Unsurprisingly, my fixes also caused a few unrelated regressions. By using only the JUnit Platform Engine, we have a single, clean implementation of the report listener that’s well aligned with the target runner. This simplifies maintenance, enables future improvements, and reduces technical debt — essentially phasing out old legacy layers. This kind of cleanup happens all the time in the IT industry. Again, if needed, you can stay on an older version or maintain a dedicated 3.5.x branch — but please don’t block forward progress for everyone else. Onward!

olamy avatar Oct 09 '25 01:10 olamy

@elharo In that case, nothing prevents you from using pluginManagement to enforce the last version of the Surefire plugin that still supports this setup. Since users relying on such configurations are already stuck with an old JUnit 3.x version, they can just as well be locked to a compatible Surefire version too. As far as I know, this is precisely what dependencyManagement and pluginManagement are meant for. On the other hand, we really need to stop doing “archaeological code collection.” JUnit 3 is no longer supported and won’t receive any updates.

Even JUnit 4 is in the meantime in maintainance mode. https://junit.org/junit4/ If someone needs JUnit 3 older versions of maven-surefire/failsafe. can be used... no problem at all...

khmarbaise avatar Oct 09 '25 06:10 khmarbaise

@elharo what is your problem with staying on an older Surefire plugin version if you need JUnit 3 support?

sparsick avatar Oct 09 '25 07:10 sparsick

On Thu, Oct 9, 2025 at 7:18 AM Sandra Parsick @.***> wrote:

sparsick left a comment (apache/maven-surefire#3185) https://github.com/apache/maven-surefire/issues/3185#issuecomment-3384471982

@elharo https://github.com/elharo what is your problem with staying on an older Surefire plugin version if you need JUnit 3 support?

I'm working on a detailed writeup of this, since the fundamental problem is much bigger than any one project, but the tldr is that the Maven repository system is incompatible with forks and patches. JUnit and surefire are specific examples of this failure mode.

-- Elliotte Rusty Harold @.***

elharo avatar Oct 09 '25 11:10 elharo

Please note junit 3.x code is still supported but junit version as dependency needs to be at least 4.12 it's only the proprieraty surefire runner code which is removed

olamy avatar Oct 14 '25 04:10 olamy