testcontainers-java
testcontainers-java copied to clipboard
Move junit-jupiter-api's dependency configuration to implementation
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.
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 for recommended configurations.
Fixes: #5680
I think the release notes should mention that projects using org.testcontainers:junit-jupiter should ensure they declare a direct dependency on org.junit.jupiter:junit-jupiter. How can we do this?
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 :)
Ironically, this CI failure illustrates exactly what happens to projects who don't declare a dependency on JUnit after the changes in this PR! :wink:
/home/runner/work/testcontainers-java/testcontainers-java/examples/neo4j-container/src/test/java/org/testcontainers/containers/Neo4jExampleTest.java:13: error: package org.junit.jupiter.api does not exist
import org.junit.jupiter.api.Test;
^
/home/runner/work/testcontainers-java/testcontainers-java/examples/neo4j-container/src/test/java/org/testcontainers/containers/Neo4jExampleTest.java:34: error: cannot find symbol
@Test
^
symbol: class Test
location: class org.testcontainers.containers.Neo4jExampleTest
Examples are failing because of missing the junit dependency :)
The remaining failures seem to have been caused by connectivity problems. Or did I miss a dependency somewhere @eddumelendez ?
checks are passing now
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 1.18.0 release (we don't have a strict SemVer policy, but it should not be in a patch release). Therefore, we don't merge it yet.
However, it added the hacktoberfest-accepted label, which counts towards your Hacktoberfest contributions, even without merging. Thanks for your work on this 🙌
Thank you so much @kiview ! :grin: I totally understand this has to wait for the appropriate release.
Thanks for your contribution, @edysli ! This is now merged in main branch and it will be part of the next release.