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

Maven(SUREFIRE-1654) recipe - Migrate from forkMode to forkCount and reuseForks #2644

Open
yeikel opened this issue Jan 13, 2023 · 3 comments
Labels
recipe Requested Recipe

Comments

@yeikel
Copy link
Contributor

yeikel commented Jan 13, 2023

I am not sure where this recipe belongs to, please move it as needed

The forkMode has been removed from the surefire plugin starting with version 3.0.0-M8

Example:

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <forkMode>always</forkMode>
                </configuration>
            </plugin>
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                 <reuseForks>false</reuseForks>
                </configuration>
            </plugin>

More information:

https://issues.apache.org/jira/browse/SUREFIRE-1654
apache/maven-surefire#575

https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html#migrating-the-deprecated-forkmode-parameter-to-forkcount-and-reu

@timtebeek
Copy link
Contributor

Weird how they took out the migration documentation in 3.0.0-M8; here's a working link to replace that last one:
https://maven.apache.org/components/surefire-archives/surefire-3.0.0-M6/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html#Migrating_the_Deprecated_forkMode_Parameter_to_forkCount_and_reuseForks

* Migrating the Deprecated forkMode Parameter to forkCount and reuseForks

  versions prior 2.14 used the parameter    forkMode   
  to configure forking. Although that parameter is still supported for backward
  compatibility, users are strongly encouraged to migrate their configuration
  and use    forkCount    and    reuseForks    instead.


  The migration is quite simple, given the following mapping:

*--------------------------+-------------------------------------------+
   Old Setting             |   New Setting                             |
*--------------------------+-------------------------------------------+
    forkMode=once          |    forkCount=1    (default),              |
 (default)                 |    reuseForks=true    (default)           |
*--------------------------+-------------------------------------------+
    forkMode=always        |    forkCount=1    (default),              |
                           |    reuseForks=false                       |
*--------------------------+-------------------------------------------+
    forkMode=never         |    forkCount=0                            |
*--------------------------+-------------------------------------------+
    forkMode=perthread   , |    forkCount=N   ,                        |
    threadCount=N          | (   reuseForks=false   , if you did not   |
                           | had that one set)                         |
*--------------------------+-------------------------------------------+

@timtebeek timtebeek added the recipe Requested Recipe label Jan 13, 2023
@timtebeek
Copy link
Contributor

Quick ping to signal that 3.0.0-M8 has been released, indeed with the removed forkMode. Luckily our JUnit 5 migration recipes so far pin to 2.22.x, so that's unlikely to break anything for now. But this recipe is definitely something to implement before we switch to surefire 3.x.

@yeikel
Copy link
Contributor Author

yeikel commented Feb 12, 2023

Quick ping to signal that 3.0.0-M8 has been released, indeed with the removed forkMode. Luckily our JUnit 5 migration recipes so far pin to 2.22.x, so that's unlikely to break anything for now. But this recipe is definitely something to implement before we switch to surefire 3.x.

This was released back in January when I created the issue. It seems that their GitHub mirror is behind

https://blogs.apache.org/maven/entry/apache-maven-surefire-failsafe-plugin1
https://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/3.0.0-M8/

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Requested Recipe
Projects
Status: Recipes Wanted
Development

No branches or pull requests

2 participants