Skip to content

Import JUnit 6 bundles#146

Merged
iloveeclipse merged 1 commit into
eclipse-jdt:masterfrom
laeubi:jdt_junit6_bundles
Oct 24, 2025
Merged

Import JUnit 6 bundles#146
iloveeclipse merged 1 commit into
eclipse-jdt:masterfrom
laeubi:jdt_junit6_bundles

Conversation

@laeubi
Copy link
Copy Markdown
Contributor

@laeubi laeubi commented Oct 24, 2025

Currently the JUnit 6 Classpathcontainer is empty unless one installs the JUnit bundles into the IDE (what is not really feasible to expect).

This now adds the JUnit 6 bundles as imports to make them install whenever the junit support is installed.

FYI @merks @akurtakov @trancexpress @iloveeclipse

Currently the JUnit 6 Classpathcontainer is empty unless one installs
the JUnit bundles into the IDE (what is not really feasible to expect).

This now adds the JUnit 6 bundles as imports to make them install
whenever the junit support is installed.
@trancexpress
Copy link
Copy Markdown
Contributor

Its very likely we'll be using eclipse-jdt/eclipse.jdt.ui#2535.

Aside from that I think the most pressing issue with adding JUnit 6 to the SDK (which e.g. this PR will do) is: eclipse-pde/eclipse.pde#2045

We need to decide what we want there, once we have the decision it should be simple to implement.

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 24, 2025

We need to decide what we want there, once we have the decision it should be simple to implement.

This can/should be just merged as it declares the dependencies of the JUnit container (that can't do it directly), whatever will require any of these bundles additionally is totally independent.

Aside from that I think the most pressing issue with adding JUnit 6 to the SDK (which e.g. this PR will do) is: eclipse-pde/eclipse.pde#2045

I don't see what PDE has to do with JDT support, and having a user message is nothing "urgent" if there is an easy workaround!

@trancexpress
Copy link
Copy Markdown
Contributor

I don't see what PDE has to do with JDT support, and having a user message is nothing "urgent" if there is an easy workaround!

If this PR is merged (or eclipse-jdt/eclipse.jdt.ui#2535), won't JUnit 6 become part of the SDK? Or am I misunderstanding what this PR will do?

Once JUnit 6 is in the SDK, launching a JUnit plug-in test will show obscure errors like this one:

Caused by: java.util.ServiceConfigurationError: org.junit.platform.engine.TestEngine: org.junit.jupiter.engine.JupiterTestEngine not a subtype

The workaround is simple, if the user knows the cause. But the above error doesn't mention the conflict.

So that is urgent from my POV and we should address it before we have JUnit 6 in the SDK.

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 24, 2025

If this PR is merged (or eclipse-jdt/eclipse.jdt.ui#2535), won't JUnit 6 become part of the SDK? Or am I misunderstanding what this PR will do?

Both wil likey result in JUnit 6 be part of the SDK yes, but the later is maybe not needed and currently seems hardly testable without making the first steps see:

Once JUnit 6 is in the SDK, launching a JUnit plug-in test will show obscure errors like this one:

I really dont see how one comes into this situation beside when using some obscure launch configs! If one uses the PDE default and a proper version range (what not only for JUnit is essential) then everything should just work.

@trancexpress
Copy link
Copy Markdown
Contributor

I really dont see how one comes into this situation beside when using some obscure launch configs! If one uses the PDE default and a proper version range (what not only for JUnit is essential) then everything should just work.

After eclipse-platform/eclipse.platform.releng.aggregator#3399 there were many discovered places where JUnit Jupiter bundles had no restricted version ranges. So using proper version ranges is not done everywhere.

The launch is not obscure, its any JUnit Plug-in Test launch configured with a JUnit 5 test runner in the launch config page.

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 24, 2025

The launch is not obscure, its any JUnit Plug-in Test launch configured with a JUnit 5 test runner in the launch config page.

Then please share an example, I always read about "duplicate" bundles and so on, by default PDE uses:

  1. the testprobe (that inevitable needs proper import range unless we support JUnit 6)
  2. the OSGi framework
  3. the runtime (that has proper ranges)

So in such combination there is actually no way for "wrong" Junit being part of the launch (or something is still broken)

Then as a user one should use a target platform (and not the running target) so JUnit 6 will even never be part of the workspace bundles and therefore never will be found.

So all these issues arise from using not recommended setup... and it does not help to delay "pure" JDT Junit support with starting at the end therefore I created #147 to outline the steps we need to get to there. So if we would have completed the two open PRs there would be an Ibuild tomorow containing that ground work and we could all easier devlop and verify patches than everyone is using a different setup.

@trancexpress
Copy link
Copy Markdown
Contributor

Then please share an example

example.zip

Run test.TestTest as "JUnit Plug-in Test". I am using the running platform as the target platform though.

Technically there is only JUnit 6 that this launch will see, but in PDE we add JUnit 5 (since we see a JUnit 5 type of launch).

Then as a user one should use a target platform (and not the running target) so JUnit 6 will even never be part of the workspace bundles and therefore never will be found.

For a start I guess yes. The target platform in my work environment is the Eclipse SDK with some extra plug-ins on top. So as soon as the SDK is updated to a version that has both JUnit 5 and 6, we will have both in the target platform. I'm sure JUnit 5 and 6 will co-exist not just in our environment.

and it does not help to delay "pure" JDT Junit support with starting at the end

I agree, its not ideal. If you think not many will be affected by this, from my POV I have no issue with the merge. In all likelihood the next Eclipse release will have JUnit 6 launch support as default, so only old test launches will cause trouble with unrestricted JUnit Jupiter requirements (which honestly I expect to be the norm and not the exception).

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 24, 2025

I am using the running platform as the target platform though.

And that's why I wrote that's not recommended .. anyways I'll look into it.

from my POV I have no issue with the merge

Then we should do it ... I just have no committer powers here.

@trancexpress
Copy link
Copy Markdown
Contributor

Anyone against including JUnit 6 in the SDK? Alongside JUnit 5.

Aside of the mentioned problem (eclipse-pde/eclipse.pde#2055) I can't think of anything else.

I guess we can always revert short-term if we find some no-go type of problem.

@iloveeclipse ?

@iloveeclipse
Copy link
Copy Markdown
Member

Aside of the mentioned problem (eclipse-pde/eclipse.pde#2055) I can't think of anything else.

Not sure I understand this. What about this problem:

Run test.TestTest as "JUnit Plug-in Test". I am using the running platform as the target platform though.

@trancexpress
Copy link
Copy Markdown
Contributor

Not sure I understand this. What about this problem:

Run test.TestTest as "JUnit Plug-in Test". I am using the running platform as the target platform though.

Assuming JUnit 6 and JUnit 5 are in the target/SDK (they will be in the SDK after this PR is merged):

When you have no version restriction of junit-jupiter-api in the plug-ins MANIFEST.MF, the JUnit 5 type launch will run into this error:

Caused by: java.util.ServiceConfigurationError: org.junit.platform.engine.TestEngine: org.junit.jupiter.engine.JupiterTestEngine not a subtype

This is because from the MANIFEST.MF requirement, JUnit 6 is pulled. But we also take JUnit 5, due to the JUnit 5 type launch. From then on the obscure exception above is thrown. The fix is to set the bundle version of junit-jupiter-api to "[5,6)", which already had to be done in various places in Eclipse projects, after merging this: https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/pull/3399

eclipse-pde/eclipse.pde#2055 just makes it clear what the user has to do in this situation, it doesn't make the error go away.

Technically we can make the error go away and maybe cause more unexpected behavior later on, since we wouldn't tell the user to fix the problem (add version constraints).

@iloveeclipse
Copy link
Copy Markdown
Member

OK, thanks. So if there would be such problem, there will be at least workaround now, and for M3 we plan to fix that gap too.
With that, I'm fine to merge now.

@iloveeclipse
Copy link
Copy Markdown
Member

iloveeclipse commented Oct 24, 2025

@merks @cdietrich : I wonder if that would affect Xtext tests? Xtext depends on JDT...

@merks
Copy link
Copy Markdown
Contributor

merks commented Oct 24, 2025

It's not always entirely clear exactly what all needs to be constrained, e.g.,

eclipse-equinox/equinox#1176 (comment)

There is resistance to actively trying to constrain the content, e.g.,

eclipse-pde/eclipse.pde@d1fe8d3

In any case, the slower this unfolds, the longer the painful runway because we can't really predict the impact of the full picture while only having a partial (stalled) picture.

@iloveeclipse
Copy link
Copy Markdown
Member

In any case, the slower this unfolds, the longer the painful runway because we can't really predict the impact of the full picture while only having a partial (stalled) picture.

I read "let's merge now".

@merks
Copy link
Copy Markdown
Contributor

merks commented Oct 24, 2025

In general it seems that adding sufficient imports with appropriate constraints (upper bounds) works around problems (though I still would hope that some of the underlying magic would be better at computing a "consistent" set of bundles). We really do need to move forward because so far the cautious approach is just extending the pain. So yes, merge.

@iloveeclipse
Copy link
Copy Markdown
Member

OK. So let's merge.

@iloveeclipse iloveeclipse merged commit e5b600e into eclipse-jdt:master Oct 24, 2025
5 checks passed
@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 25, 2025

@merks I'm currently working on a "non hacky way" of what you have proposed but I wanted to point out that we have two parts here:

  1. JDT should be able to execute JUnit 6 test, I'm a bit confused no one seem to want to use that but it feels natural to make this work before PDE as PDE currently depends on it
  2. PDE / Tycho likely need some adjustments and it is maybe not 100% convenient but we have working solutions

By the way todays IBuild succeed, so for me it looks like we have no general problems during building... lets see what the tests show and this is maybe the most important part for me, that we get a state where it runs, so as @iloveeclipse say we can complement the support in m3.

@iloveeclipse
Copy link
Copy Markdown
Member

Only for the record: this PR triggered eclipse-platform/eclipse.platform.releng.aggregator#3430 and all subsequent fixes/workarounds.

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 27, 2025

Only for the record: this PR triggered eclipse-platform/eclipse.platform.releng.aggregator#3430 and all subsequent fixes/workarounds.

Yes this was somehow expected to show some irregularities. If all goes worse, we can quite easy revert this so better have it with a simple change than with an actual bigger feature. But I think it progress quite well and we have already identified some issues (in platform and tycho).

@iloveeclipse
Copy link
Copy Markdown
Member

Only for the record

It was for record only, so tickets have links to understand what is coming from where and all that dependencies.

@laeubi
Copy link
Copy Markdown
Contributor Author

laeubi commented Oct 27, 2025

Only for the record

It was for record only, so tickets have links to understand what is coming from where and all that dependencies.

I didn't question that, just added something else, for the record, as I noticed it was not that clear in the initial PR description.

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.

4 participants