Skip to content

Include 6 in junit.platform import version range#7054

Draft
chrisrueger wants to merge 2 commits intobndtools:masterfrom
chrisrueger:junit6
Draft

Include 6 in junit.platform import version range#7054
chrisrueger wants to merge 2 commits intobndtools:masterfrom
chrisrueger:junit6

Conversation

@chrisrueger
Copy link
Contributor

Closes #7052

Updated the Import-Package directive to limit org.junit.platform.* to versions below 7, ensuring compatibility with supported JUnit Platform versions including to Junit6. This is because of JUnit6's new version scheme where all versions now start at 6.x : https://github.com/junit-team/junit-framework/wiki/Upgrading-to-JUnit-6.0#new-versioning-scheme

This creates the following Import-Package for biz.aQute.tester.junit-platform.jar

[MANIFEST]

Automatic-Module-Name                   biz.aQute.tester.junit-platform
Bundle-Activator                        aQute.tester.junit.platform.Activator
Bundle-Copyright                        Copyright (c) aQute SARL (2000, 2026) and others. All Rights Reserved.
Bundle-Description                      A bnd tester using JUnit Platform. Like biz.aQute.tester, this bundle will add itself to the -runbundles at the end. At startup, this bundle will then look for TestEngine implementations among the loaded bundles and use them to execute the tests. This bundle does NOT contain the necessary TestEngine implementations for JUnit 3, 4 or 5 - it will import them just like any other bundle.
Bundle-Developers                       bjhargrave;email="bj@hargrave.dev";name="BJ Hargrave";organization=IBM;organizationUrl="https://developer.ibm.com";roles=developer;timezone="America/New_York";url="https://github.com/bjhargrave"
                                        chrisrueger;email="chrisrueger@gmail.com";name="Christoph Rueger";organization="Synesty GmbH";organizationUrl="https://synesty.com/";roles=developer;timezone="Europe/Berlin"
                                        peterkir;email="peter@klib.io";name="Peter Kirschner";organization="Kirschners GmbH";organizationUrl="https://peterkir.github.io/";roles=developer;timezone="Europe/Berlin";url="https://peterkir.github.io"
                                        pkriens;email="Peter.Kriens@aQute.biz";name="Peter Kriens";organization=Bndtools;organizationUrl="https://github.com/bndtools";roles="architect,developer";timezone=1
                                        rotty3000;email="raymond.auge@liferay.com";name="Ray Augé";organization="Liferay Inc.";organizationUrl="https://www.liferay.com";roles=developer;timezone="America/New_York";url="https://rotty3000.github.io"
Bundle-DocURL                           https://bnd.bndtools.org/
Bundle-License                          (Apache-2.0 OR EPL-2.0);description="This program and the accompanying materials are made available under the terms of the Apache License, Version 2.0, or the Eclipse Public License 2.0.";link="https://opensource.org/licenses/Apache-2.0,https://opensource.org/licenses/EPL-2.0"
Bundle-ManifestVersion                  2
Bundle-Name                             biz.aQute.tester.junit-platform
Bundle-SCM                              connection=scm:git:https://github.com/bndtools/bnd.git
                                        developerConnection=scm:git:git@github.com:bndtools/bnd.git
                                        tag=7.3.0-SNAPSHOT
                                        url=https://github.com/bndtools/bnd
Bundle-SymbolicName                     biz.aQute.tester.junit-platform
Bundle-Vendor                           Bndtools https://bndtools.org/
Bundle-Version                          7.3.0.202601141157-SNAPSHOT
Export-Package                          aQute.junit.system;version="7.3.0"
Git-Descriptor                          7.3.0.DEV-136-g5db283c12-dirty
Git-SHA                                 5db283c12d8caa48b1c912e9efc21283291b8d72
Import-Package                          aQute.bnd.build;version="[4.7,5)";resolution:=optional
                                        aQute.bnd.service;version="[4.9,5)";resolution:=optional
                                        aQute.junit.system;version="[7.3,8)";resolution:=optional
                                        javax.xml.stream
                                        junit.framework;version="[3.8,5)";resolution:=optional
                                        org.apache.felix.service.command;version="[1.0,2)";resolution:=optional
                                        org.junit.platform.commons.support;version="[1.10,7)"
                                        org.junit.platform.commons.util;version="[1.10,7)"
                                        org.junit.platform.commons;version="[1.10,7)"
                                        org.junit.platform.engine.discovery;version="[1.10,7)"
                                        org.junit.platform.engine.reporting;version="[1.10,7)"
                                        org.junit.platform.engine.support.descriptor;version="[1.10,7)"
                                        org.junit.platform.engine;version="[1.10,7)"
                                        org.junit.platform.launcher.core;version="[1.10,7)"
                                        org.junit.platform.launcher.listeners;version="[1.10,7)"
                                        org.junit.platform.launcher;version="[1.10,7)"
                                        org.junit;version="[4.10,5)";resolution:=optional
                                        org.opentest4j;version="[1.3,2)"
                                        org.osgi.framework.wiring;version="[1.2,2)"
                                        org.osgi.framework;version="[1.8,2)"
                                        org.osgi.util.tracker;version="[1.5,2)"
Manifest-Version                        1.0
Private-Package                         aQute.lib.hex;version="1.4.0"
                                        aQute.lib.strings;version="1.12.0"
                                        aQute.libg.qtokens;version="1.3.0"
                                        aQute.tester.bundle.engine
                                        aQute.tester.bundle.engine.discovery
                                        aQute.tester.junit.platform
                                        aQute.tester.junit.platform.plugin
                                        aQute.tester.junit.platform.reporting.legacy
                                        aQute.tester.junit.platform.reporting.legacy.xml
                                        aQute.tester.junit.platform.utils
Provide-Capability                      osgi.service;objectClass:List<String>="org.junit.platform.engine.TestEngine";effective:=active
                                        osgi.serviceloader;osgi.serviceloader="org.junit.platform.engine.TestEngine";register:="aQute.tester.bundle.engine.BundleEngine"
Require-Capability                      osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=17))"
                                        osgi.extender;filter:="(&(osgi.extender=osgi.serviceloader.registrar)(version>=1.0.0)(!(version>=2.0.0)))";resolution:=optional
SPDX-License-Identifier                 (Apache-2.0 OR EPL-2.0)
Tester-Plugin                           aQute.tester.junit.platform.plugin.ProjectTesterImpl


Updated the Import-Package directive to limit org.junit.platform.* to versions below 7, ensuring compatibility with supported JUnit Platform versions including to Junit6.
This is because of JUnit6's new version scheme where all versions now start at 6.x : https://github.com/junit-team/junit-framework/wiki/Upgrading-to-JUnit-6.0#new-versioning-scheme

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
@chrisrueger
Copy link
Contributor Author

chrisrueger commented Jan 18, 2026

Converted back to draft. I did some local tests with the tests of bnd's testsuite itself and tried to upgrade it to JUnit6. All tests failed. It turns out JUnit6's OSGi headers are different so that the range expansion alone is not enough.

Example junit-platform-commons:

JUnit Platform 1.10.1

just had

Export-Package: org.junit.platform.commons.util
  version=1.10.1
  status=DEPRECATED

JUnit Platform 6.0.2

has

Export-Package: org.junit.platform.commons.util
  version=6.0.2
  status=INTERNAL
  mandatory:=status

Notice the mandatory:=status.
This means that consumers ( biz.aQute.tester.junit-platform) now also need to explicitly query the status attribute=INTERNAL in the filter (basically saying: "I really really want this evil INTERNAL stuff").
e.g.

I could make some tests pass by explicitly filtering for the status=INTERNAL

Import-Package: org.junit.platform.commons.util;status=INTERNAL;version="[6,7)";resolution:=optional, \
	org.junit.platform.*;version="${range;[==,7);${junit.platform.tester.version}}",\

instead of just

Import-Package: org.junit.platform.*;version="${range;[==,7);${junit.platform.tester.version}}",\

(without the status=INTERNAL filter)

But I am not sure and there were still some tests which did not work. I guess because there is more similar stuff like org.junit.platform.commons.util which I didn't identify yet and which leads to different classloading effects so that some packages of JUnit are coming from JUnit5 and some from Junit6 which create a mess. Note might only be a bnd problem because in our testsuite we have multiple JUnit versions available at the same time. So having a single large filter for like ${range[==,7);${junit.platform.tester.version}} (which basically is [1.10.1,7) is not enough anymore and really hard to reason about.

Long story short: I think biz.aQute.tester.junit-platform is not yet compatible with JUnit6.
Maybe we need a new biz.aQute.tester.junit-platform-junit6.

@kriegfrj any thoughts?

Bump JUnit Jupiter and JUnit Platform versions from 5.14.2/1.14.2 to 6.0.2 in build and configuration files. Update import in bnd.bnd to support org.junit.platform.commons.util for JUnit 6 compatibility, with a note about ongoing compatibility issues between JUnit 5 and 6.

A lot of tests in ActivatorJUnitPlatformLatestTest work (but not all) while all now fail in ActivatorJUnitPlatformEarliestTest

This commit is just to capture my current state of work, to have a reference point where I am currently at. It is not working yet

Signed-off-by: Christoph Rueger <chrisrueger@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

biz.aQute.tester.junit-platform conflicts with Junit 6

1 participant