-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move junit-jupiter-api's dependency configuration to implementation #5985
Conversation
Stop exposing `org.junit.jupiter:junit-jupiter-api` as a transitive dependency of `org.testcontainers:junit-jupiter` by including it using the `implementation` configuration instead of `api`. This should prevent conflicts with dependencies on JUnit 5 declared by users of `org.testcontainers:junit-jupiter`. Also use JUnit's BOM to simplify version management of all included JUnit artifacts. For running this module's tests, a `testImplementation` dependency on `org.junit.jupiter:junit-jupiter` is enough, as recommended in the [JUnit 5 User Guide][junit5guide]. Users of the `@Testcontainers` annotation must ensure their project direcly declares a test-scoped dependency on `org.junit.jupiter:junit-jupiter` in addition to `org.testcontainers:junit-jupiter`. See the [JUnit 5 User Guide][junit5guide] for recommended configurations. Fixes: testcontainers#5680 [junit5guide]: https://junit.org/junit5/docs/current/user-guide/#running-tests-build "JUnit 5 User Guide: Build Support"
I think the release notes should mention that projects using |
thanks for submitting the PR @edysli ! If we decide to include it in the next release, we will include a note on the Release Notes. Examples are failing because of missing the junit dependency :) |
Add a direct dependency on `org.junit.jupiter:junit-jupiter:5.9.1` to stop relying on it being transitively provided by `org.testcontainers:junit-jupiter`.
Ironically, this CI failure illustrates exactly what happens to projects who don't declare a dependency on JUnit after the changes in this PR! 😉
|
The remaining failures seem to have been caused by connectivity problems. Or did I miss a dependency somewhere @eddumelendez ? |
checks are passing now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @edysli.
I think this is the right approach, so we will need to live with the breaking change. Ideally, it is not breaking for most users, since they should already have a direct dependency to junit-jupiter
declared, but we will still need to highlight it in the release notes, as mentioned by @eddumelendez.
Just FYI @edysli, we plan to eventually merge this PR, since we think it is the right approach. However, because of its breaking nature, we want to include it in the However, it added the |
Thank you so much @kiview ! 😁 I totally understand this has to wait for the appropriate release. |
Thanks for your contribution, @edysli ! This is now merged in |
Stop exposing
org.junit.jupiter:junit-jupiter-api
as a transitive dependency oforg.testcontainers:junit-jupiter
by including it using theimplementation
configuration instead ofapi
. This should prevent conflicts with dependencies on JUnit 5 declared by users oforg.testcontainers:junit-jupiter
.Also use JUnit's BOM to simplify version management of all included JUnit artifacts. For running this module's tests, a
testImplementation
dependency onorg.junit.jupiter:junit-jupiter
is enough, as recommended in the JUnit 5 User Guide.Users of the
@Testcontainers
annotation must ensure their project direcly declares a test-scoped dependency onorg.junit.jupiter:junit-jupiter
in addition toorg.testcontainers:junit-jupiter
. See the JUnit 5 User Guide for recommended configurations.Fixes: #5680