in src/main/java/org/apache/maven/plugins/shade/relocation/SimpleRelocator.java [77:132]
public SimpleRelocator(
String patt, String shadedPattern, List<String> includes, List<String> excludes, boolean rawString) {
this.rawString = rawString;
if (rawString) {
this.pathPattern = patt;
this.shadedPathPattern = shadedPattern;
this.pattern = null; // not used for raw string relocator
this.shadedPattern = null; // not used for raw string relocator
} else {
if (patt == null) {
this.pattern = "";
this.pathPattern = "";
} else {
this.pattern = patt.replace('/', '.');
this.pathPattern = patt.replace('.', '/');
}
if (shadedPattern != null) {
this.shadedPattern = shadedPattern.replace('/', '.');
this.shadedPathPattern = shadedPattern.replace('.', '/');
} else {
this.shadedPattern = "hidden." + this.pattern;
this.shadedPathPattern = "hidden/" + this.pathPattern;
}
}
this.includes = normalizePatterns(includes);
this.excludes = normalizePatterns(excludes);
// Don't replace all dots to slashes, otherwise /META-INF/maven/${groupId} can't be matched.
if (includes != null && !includes.isEmpty()) {
this.includes.addAll(includes);
}
if (excludes != null && !excludes.isEmpty()) {
this.excludes.addAll(excludes);
}
if (!rawString && this.excludes != null) {
// Create exclude pattern sets for sources
for (String exclude : this.excludes) {
// Excludes should be subpackages of the global pattern
if (exclude.startsWith(pattern)) {
sourcePackageExcludes.add(
exclude.substring(pattern.length()).replaceFirst("[.][*]$", ""));
}
// Excludes should be subpackages of the global pattern
if (exclude.startsWith(pathPattern)) {
sourcePathExcludes.add(
exclude.substring(pathPattern.length()).replaceFirst("[/][*]$", ""));
}
}
}
}