Skip to content
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

Remove the need to the dependency org.pitest pitest-junit5-plugin for pitest-maven projects with recent JDK, and junit 5 #1367

Open
patpatpat123 opened this issue Dec 11, 2024 · 2 comments

Comments

@patpatpat123
Copy link

Hello team,

Just wanted to reach out with a small enhancement request.
Our project uses a fairly new stack, JDK 23, maven 3.9+ and JUNIT5.

We rely on pitest for many mutation analyses, which is a great tool by the way.

However, in our pom, we are obliged to be dependent on the org.pitest pitest-junit5-plugin.

 <plugin>
                <groupId>org.pitest</groupId>
                <artifactId>pitest-maven</artifactId>
                <version>1.17.2</version>
                <configuration>
                    <skip>false</skip>
                    <sourceDataFormats>
                        <sourceDataFormat>HTML</sourceDataFormat>
                        <sourceDataFormat>HTML</sourceDataFormat>
                    </sourceDataFormats>
                    <threads>16</threads>
                    <outputFormats>
                        <param>XML</param>
                        <param>HTML</param>
                    </outputFormats>
                    <mutators>
                        <mutator>CONDITIONALS_BOUNDARY</mutator>
                        <mutator>INCREMENTS</mutator>
                        <mutator>INVERT_NEGS</mutator>
                        <mutator>MATH</mutator>
                        <mutator>NEGATE_CONDITIONALS</mutator>
                        <mutator>EMPTY_RETURNS</mutator>
                        <mutator>FALSE_RETURNS</mutator>
                        <mutator>TRUE_RETURNS</mutator>
                        <mutator>PRIMITIVE_RETURNS</mutator>
                        <mutator>REMOVE_INCREMENTS</mutator>
                        <mutator>EXPERIMENTAL_BIG_INTEGER</mutator>
                        <mutator>EXPERIMENTAL_MEMBER_VARIABLE</mutator>
                        <mutator>EXPERIMENTAL_SWITCH</mutator>
                    </mutators>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.pitest</groupId>
                        <artifactId>pitest-junit5-plugin</artifactId>
                        <version>1.2.1</version>
                    </dependency>
                </dependencies>
            </plugin>

It seems this plugin has not been updated for more than a year now.

Instead of asking clients to pull in this dependency just for compatibility with JUNIT5, can we break the dependency?

For instance, can we make some code changes on org.pitest pitest-maven directly to support junit5?

Thank you for your help.

@patpatpat123
Copy link
Author

Here is the stacktrace without pitest-junit5, would be great if we can remove this dependency:

[ERROR] Failed to execute goal org.pitest:pitest-maven:1.17.4:mutationCoverage (default-cli) on project abc: Execution default-cli of goal org.pitest:pitest-maven:1.17.4:mutationCoverage failed: Please check you have correctly installed the pitest plugin for your project's test library (JUnit 5, TestNG, JUnit 4 etc). 
[ERROR] 
[ERROR] Please copy and paste the information and the complete stacktrace below when reporting an issue
[ERROR] VM : OpenJDK 64-Bit Server VM
[ERROR] Vendor : SAP SE
[ERROR] Version : 23+37
[ERROR] Uptime : 143191
[ERROR] Input -> 
[ERROR]  1 : -Dclassworlds.conf=/usr/share/maven/bin/m2.conf
[ERROR]  2 : -Dmaven.home=/usr/share/maven
[ERROR]  3 : -Dlibrary.jansi.path=/usr/share/maven/lib/jansi-native
[ERROR]  4 : -Dmaven.multiModuleProjectDirectory=/builds/project/abc
[ERROR] BootClassPathSupported : false
[ERROR] 
[ERROR] 
[ERROR] Please copy and paste the information and the complete stacktrace below when reporting an issue
[ERROR] VM : OpenJDK 64-Bit Server VM
[ERROR] Vendor : SAP SE
[ERROR] Version : 23+37
[ERROR] Uptime : 143192
[ERROR] Input -> 
[ERROR]  1 : -Dclassworlds.conf=/usr/share/maven/bin/m2.conf
[ERROR]  2 : -Dmaven.home=/usr/share/maven
[ERROR]  3 : -Dlibrary.jansi.path=/usr/share/maven/lib/jansi-native
[ERROR]  4 : -Dmaven.multiModuleProjectDirectory=/builds/project/abc
[ERROR] BootClassPathSupported : false
[ERROR] 
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 

@hcoles
Copy link
Owner

hcoles commented Jan 23, 2025

Although the junit5 plugin has been stable recently, introducing a hard dependency on it would mean pitest would be forced to tie itself to a particular version of junit if any backwards incompatible changes were made to the api in the future.

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

No branches or pull requests

2 participants