-
Notifications
You must be signed in to change notification settings - Fork 58
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
Auto add junit-platform-launcher to classpath #337
Comments
Do you expect to have the plugin (even) more clumsy with the new JUnit Platform versions? Or due to the more stable stable API (then internal implementation which currently can fail due to the mismatch of the shaded version and the other Platform component) it is expected to have greater compatibility? It would be probably required to have some version checking and add the dependency only if pitest-junit5-plugin >=1.2.0 (or you plan to release 2.0.0?). It's somehow related to some other idea to automatically take plugin version to match the JUnit Platform version used in the project provided by @nagkumar, which in general is sensible, but I don't see a good way to map the future versions of JUnit Platform to the exact versions of the plugin (without doing any runtime remote dependency resolution which would be slow, fragile and problematic). |
The junit api the plugin depends on seems to be pretty stable (the plugin compiles against platform for all versions from 1.10.0-M1 down to 1.2.0 without any change), but as we've seen there have been frequent breakages one step up (where the launcher api interacts with the rest of junit). So things ought to be much more stable with this change. I'll release the plugin as 2.0.0 as it is a breaking change. #334 made sense from a user point of view, but sounds like a maintainance nightmare. If the need to release the pitest junit plugin in sync with junit changes has been largely removed, hopefully the motivation behind #334 has been addressed. |
A bit more information. The Maven plugin only adds the plugin JAR itself to the SUT classpath, but not any of its declared dependencies. The Gradle plugin behaves differently from the Maven plugin, in that it takes into account the declared dependencies of the PIT plugins. With switching to non-transitive (or if the junit5 plugin declares the launcher as "provided" which would probably make sense), it would then break in Gradle as then the launcher is missing from the SUT classpath. |
@Vampire 2.0.0 will change the platform dependency to be provided, so it will not appear as a dependency. |
Ok, yeah, then this change will be necessary anyway. |
Having thought this through, I think I'll release a 1.2.0 of the junit 5 plugin with the dependency still declared. This will be breaking for maven users, and non breaking for gradle users. Version 2.0.0 will be released with the dependency no longer declared once the gradle plugin has been updated. Net result is
|
Actually, depending on how the Gradle build is written, it even works already with If you use
it does not work. But if you instead use
then Gradle already adds the So the change for this issue could also just be a documentation change to require using the test suites DSL or otherwise include the launcher manually as |
Just for the history and to complete the picture... junit5PluginVersion.set("1.2.0")
pitestVersion.set("1.14.1") I've faced with an error
due to
I've fixed it with adding testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
because("required for pitest")
} |
@mfvanek You can check also using |
@szpak |
Thanks for letting me know. Adding a mechanism for |
... for JUnit Platform projects to avoid "UNKNOWN_ERROR" or: "NoClassDefFoundError: org.junit.platform.launcher.core.LauncherFactory" with PIT 1.14.0+ (with pitest-junit-plugin 1.2.0+). That dependency is no longer shared. More details: #337
... for JUnit Platform projects to avoid "UNKNOWN_ERROR" or: "NoClassDefFoundError: org.junit.platform.launcher.core.LauncherFactory" with PIT 1.14.0+ (with pitest-junit-plugin 1.2.0+). That dependency is no longer shaded. More details: #337
For people facing this problem in real projects. You may it it a try with the new SNAPSHOT version trying to fix the problem (in functional tests it works). For details: #353 (comment) |
Implemented in 1.15.0. |
Version mismatches between the pitest-junit5-plugin and junit itself have been causing a constant stream of support requests, this will be resolved when pitest 1.14.0 is released, but will require a change to the gradle plugin.
Currently, junit-platform-launcher is included as a shaded dependency in the pitest-junit-plugin jar. This is a cludge to work around the fact that platform launcher doesn't appear on the normal test classpath for maven or for gradle. The maven surefire plugin pulls in the correct version of it automatically if it detects the junit 5 engine on the classpath, and gradle presumably does something similar.
The pitest maven plugin will start replicating the behaviour in 1.14.0, and the next release of the junit 5 plugin will therefore remove the shaded dependency.
The same functionality will be required in the gradle plugin (although the dependency could be added manually if this is painful to do).
See
hcoles/pitest#1212
The text was updated successfully, but these errors were encountered: