Uploaded image for project: 'Maven Surefire'
  1. Maven Surefire
  2. SUREFIRE-1599

%regex pattern handling does not match documentation

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.22.0, 2.22.1
    • None
    • documentation
    • None
    • Windows

    Description

      This pull request updated the inclusion/exclusion documentation to state:

      Regex matches are done over paths using slashes ("/") and not package names using dots ("."), so the "." in pkg.*Slow.*.class is a regex metacharacter, which happens to match any character, notably the (forward) slashes ("/") that make up the path. Slashes here are forward, even on Windows

      That's not true, at least in Surefire 2.22+. I've prepared a simple reproduction. Built on Linux or macOS, Surefire will correctly skip ExampleIntegrationTest, but on Windows it will run (and fail the build).

      Surefire is configured as follows:

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.1</version>
          <configuration>
              <excludes>
                  <exclude>%regex[it/.*]</exclude>
              </excludes>
          </configuration>
      </plugin>
      

      Per the documentation, that forward slash should work on Windows as well as Linux and macOS.

      (Note: This also effects Failsafe, as one might expect.)

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            bturner Bryan Turner

            Dates

              Created:
              Updated:

              Slack

                Issue deployment