eclipse.platform.releng.aggregator icon indicating copy to clipboard operation
eclipse.platform.releng.aggregator copied to clipboard

Update to JUnit 6

Open akurtakov opened this issue 2 months ago • 11 comments

JUnit 6 has been released (https://docs.junit.org/6.0.0/release-notes/) . PR is not open automatically as major updates are disabled (https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/70865a7e7e87eb0808727ae700b0d4e8c9b7b0b5/eclipse-platform-parent/pom.xml#L512).

akurtakov avatar Oct 01 '25 07:10 akurtakov

@merks @iloveeclipse @noopur2507 WDYT?

akurtakov avatar Oct 01 '25 07:10 akurtakov

I think we then need a new JUnit 6 container, also likely we want to have both version of JUnit5+6 as we have JUnit 3/4 here as well.

laeubi avatar Oct 01 '25 07:10 laeubi

If JUnit 6 can run all of JUnit 5 we might not need JUnit 5 anymore. Much like JUnit 4 is used to support JUnit 3 .

akurtakov avatar Oct 01 '25 07:10 akurtakov

  • Not sure how much effort it would require on JDT side, is there a way to add the libraries to platform to see how much API is broken now?
  • M2 could be OK depending how much effort this will cause.
  • Support for cancelling test execution via CancellationToken - Finally!
  • Removal of various deprecated behaviors and APIs - as usually this will most likely break a lot...
  • The junit-platform-runner module which provided the JUnit 4 based JUnitPlatform runner has been removed.

iloveeclipse avatar Oct 01 '25 07:10 iloveeclipse

If JUnit 6 can run all of JUnit 5 we might not need JUnit 5 anymore. Much like JUnit 4 is used to support JUnit 3 .

JUnit 6 can run all JUnit 3/4/5 and so on... but e.g. Unit 6 require Java 17 so you won't be able anymore to run tests on a Java 8/11 JVM ...

laeubi avatar Oct 01 '25 07:10 laeubi

If JUnit 6 can run all of JUnit 5 we might not need JUnit 5 anymore. Much like JUnit 4 is used to support JUnit 3 .

I've opened an issue at JDT UI, asking if we are adding support for JUnit 6 in parallel to JUnit 5, or if we are replacing JUnit 5 support with JUnit 6: https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/2530

From the perspective of just running tests (and not supporting different JUnit versions in JDT), I think JUnit 6 can replace JUnit 5. But if we want support for both in JDT, I assume we must keep both in the platform.

trancexpress avatar Oct 03 '25 12:10 trancexpress

In PDE we also have to make sure only the platform/engine bundles in a suitable range are added to the runtime. I.e. places like https://github.com/eclipse-pde/eclipse.pde/blob/46ec758af5eaa624f789269a41656c609e24aeae/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java#L562-L568

need adjustments. I can have a look at it tomorrow.

HannesWell avatar Oct 10 '25 00:10 HannesWell

In PDE we also have to make sure only the platform/engine bundles in a suitable range are added to the runtime. I.e. places like https://github.com/eclipse-pde/eclipse.pde/blob/46ec758af5eaa624f789269a41656c609e24aeae/ui/org.eclipse.pde.launching/src/org/eclipse/pde/launching/JUnitLaunchConfigurationDelegate.java#L562-L568

need adjustments.

See also

  • https://github.com/eclipse-pde/eclipse.pde/issues/2006
  • https://github.com/eclipse-pde/eclipse.pde/issues/2007

HannesWell avatar Oct 10 '25 16:10 HannesWell

I'm trying to build locally with the required PDE changes to test them, but I run into issues:

clear ; git clean -fdx ; git submodule foreach "git clean -fdx" ; rm -rf /tmp/.m2/ ; export JAVA_HOME=/usr/lib/jvm/java-21/ && /home/sandreev/libraries/maven3910/bin/mvn -e clean install -pl :eclipse-sdk-prereqs,:org.eclipse.jdt.core.compiler.batch -Dmaven.repo.local=/tmp/.m2/repository -DlocalEcjVersion=99.99 && mvn -e clean verify -Pbree-libs -DaggregatorBuild=true -DskipTests=true -Dmaven.repo.local=/tmp/.m2/repository -Dcbi-ecj-version=99.99
compile (default-compile) on project org.eclipse.equinox.http.service.api: useJDK = BREE configured, but no toolchain of type 'jdk' with id 'JavaSE-1.8' found
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:5.0.0:compile (default-compile) on project org.eclipse.equinox.http.service.api: useJDK = BREE configured, but no toolchain of type 'jdk' with id 'JavaSE-1.8' found. See https://maven.apache.org/guides/mini/guide-using-toolchains.html -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:5.0.0:compile (default-compile) on project org.eclipse.equinox.http.service.api: useJDK = BREE configured, but no toolchain of type 'jdk' with id 'JavaSE-1.8' found. See https://maven.apache.org/guides/mini/guide-using-toolchains.html
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
Caused by: org.apache.maven.plugin.MojoExecutionException: useJDK = BREE configured, but no toolchain of type 'jdk' with id 'JavaSE-1.8' found. See https://maven.apache.org/guides/mini/guide-using-toolchains.html
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.lambda$configureJavaHome$10 (AbstractOsgiCompilerMojo.java:805)
    at java.util.Optional.orElseThrow (Optional.java:403)
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.configureJavaHome (AbstractOsgiCompilerMojo.java:805)
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.getCompilerConfiguration (AbstractOsgiCompilerMojo.java:715)
    at copied.org.apache.maven.plugin.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:334)
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.doCompile (AbstractOsgiCompilerMojo.java:385)
    at org.eclipse.tycho.compiler.AbstractOsgiCompilerMojo.execute (AbstractOsgiCompilerMojo.java:366)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :org.eclipse.equinox.http.service.api

I was using the same command a few days ago without issue. Do I need to define extra parameters for mvn or extra ENV variables?

trancexpress avatar Oct 12 '25 09:10 trancexpress

Are you sure you want to rm -rf /tmp/.m2/ your m2 repo + the settings? That's a bit unusual and you likley then need to specify an explicit location to your toolchains.xml

laeubi avatar Oct 12 '25 12:10 laeubi

Are you sure you want to rm -rf /tmp/.m2/ your m2 repo + the settings? That's a bit unusual and you likley then need to specify an explicit location to your toolchains.xml

Ah, you are right. I did delete ~/.m2/ for something else I was doing, that one has the toolchain definition. I forgot...

For using /tmp/.m2/ its just how we build the SDK and I've copied that from our build script.

trancexpress avatar Oct 12 '25 12:10 trancexpress

I believe this ticket can be closed. Whatever is pending should go to https://github.com/eclipse-jdt/eclipse.jdt/issues/147

iloveeclipse avatar Nov 17 '25 07:11 iloveeclipse