apache / apache/maven-surefire

[SUREFIRE-1599] %regex pattern handling does not match documentation

Open
#2,255 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Bryan Turner](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=bturner)** opened **[SUREFIRE-1599](https://issues.apache.org/jira/browse/SUREFIRE-1599?redirect=false)** and commented

[This pull request](https://github.com/apache/maven-surefire/pull/138) 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](https://github.com/bturner/surefire-slashes). 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:

```

org.apache.maven.plugins
maven-surefire-plugin
2.22.1


%regex[it/.*]

```

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.)

---

**Affects:** 2.22.0, 2.22.1

Contributor guide

Open the contributing guide

Research direction

Start with the linked simple reproduction and the Maven Surefire configuration using the %regex exclusion. Trace how exclusion paths are matched on Windows versus Linux and macOS, then verify that the documented forward-slash pattern consistently skips ExampleIntegrationTest without affecting the other platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.