You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kwin (via GitHub)" <gi...@apache.org> on 2026/03/04 19:34:34 UTC
[I] SimpleRelocator doesn't quote patterns correctly [maven-shade-plugin]
kwin opened a new issue, #790:
URL: https://github.com/apache/maven-shade-plugin/issues/790
### Affected version
3.6.1
### Bug description
According to all examples in https://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html and also in https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#relocations both `pattern` and `shadedPattern` contain `.` in a literal way (i.e. not representing an arbitrary character like in a regular expression).
However the value is used as is when passing as first argument to `String.replaceFirst(String, String)`. In this case the `.` is used as placeholder in a regular expression.
This leads to the following incorrect results:
```
String relocated = new SimpleRelocator("org.foo", null, null, null).replaceClass("orgxfoo.foo.Bar");
// relocated is now "hidden.orgxfoo.foo.Bar" but should be "orgxfoo.foo.Bar" because the pattern should not match
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SimpleRelocator doesn't quote regular expression patterns (`pattern`/`pathPattern`) correctly [maven-shade-plugin]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin closed issue #790: SimpleRelocator doesn't quote regular expression patterns (`pattern`/`pathPattern`) correctly
URL: https://github.com/apache/maven-shade-plugin/issues/790
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SimpleRelocator doesn't quote patterns correctly [maven-shade-plugin]
Posted by "kwin (via GitHub)" <gi...@apache.org>.
kwin commented on issue #790:
URL: https://github.com/apache/maven-shade-plugin/issues/790#issuecomment-3999808630
I would recommend to clarify https://github.com/apache/maven-shade-plugin/blob/06902bde990d317bc71654e8eaa62b4a1ad47ad2/src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java#L33 with regards to field names.
Although everything is named pattern, sometimes it is a
1. String value (`shadedPattern`, `shadedPathPattern`) or a
2. Regular expression pattern (`pattern`, `pathPattern`) or a
3. Ant-based glob pattern (`include`, `exclude`)
The second category should also not be stored as `String` but rather as compiled `Pattern` to speed up the actual replacements.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org