|
52 | 52 | import java.util.Properties;
|
53 | 53 | import java.util.Set;
|
54 | 54 | import java.util.StringTokenizer;
|
| 55 | +import java.util.regex.Pattern; |
55 | 56 | import java.util.stream.Collectors;
|
56 | 57 |
|
57 | 58 | import org.apache.commons.lang3.BooleanUtils;
|
@@ -1210,7 +1211,7 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
|
1210 | 1211 | * <br/>
|
1211 | 1212 | * <b>Note</b>: if {@link #detectOfflineLinks} is defined, the offline links between the project modules are
|
1212 | 1213 | * automatically added if the goal is calling in a non-aggregator way.
|
1213 |
| - * @see OfflineLink. |
| 1214 | + * @see OfflineLink |
1214 | 1215 | * @see <a href="https://docs.oracle.com/en/java/javase/17/docs/specs/man/javadoc.html#additional-options-provided-by-the-standard-doclet">Doclet option linkoffline</a>
|
1215 | 1216 | */
|
1216 | 1217 | @Parameter(property = "offlineLinks")
|
@@ -1642,14 +1643,19 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
|
1642 | 1643 |
|
1643 | 1644 | /**
|
1644 | 1645 | * <p>
|
1645 |
| - * Comma separated list of modules (artifactId) to not add in aggregated javadoc |
| 1646 | + * Comma separated list of modules (can be regular expression) in the format ([group:]artifactId) to not add in aggregated javadoc |
1646 | 1647 | * </p>
|
1647 | 1648 | *
|
1648 | 1649 | * @since 3.2.0
|
1649 | 1650 | */
|
1650 | 1651 | @Parameter(property = "maven.javadoc.skippedModules")
|
1651 | 1652 | private String skippedModules;
|
1652 | 1653 |
|
| 1654 | + /** |
| 1655 | + * List built once from the parameter {@link #skippedModules} |
| 1656 | + */ |
| 1657 | + private List<Pattern> patternsToSkip; |
| 1658 | + |
1653 | 1659 | /**
|
1654 | 1660 | * Timestamp for reproducible output archive entries, either formatted as ISO 8601
|
1655 | 1661 | * <code>yyyy-MM-dd'T'HH:mm:ssXXX</code> or as an int representing seconds since the epoch (like
|
@@ -6043,8 +6049,20 @@ protected boolean isSkippedModule(MavenProject mavenProject) {
|
6043 | 6049 | if (this.skippedModules == null || this.skippedModules.isEmpty()) {
|
6044 | 6050 | return false;
|
6045 | 6051 | }
|
6046 |
| - List<String> modulesToSkip = Arrays.asList(StringUtils.split(this.skippedModules, ',')); |
6047 |
| - return modulesToSkip.contains(mavenProject.getArtifactId()); |
| 6052 | + if (this.patternsToSkip == null) { |
| 6053 | + this.patternsToSkip = Arrays.stream(StringUtils.split(this.skippedModules, ',')) |
| 6054 | + .map(String::trim) |
| 6055 | + // we are expecting something such [groupdId:]artifactId so if no groupId we want to match any |
| 6056 | + // groupId |
| 6057 | + .map(s -> !s.contains(":") ? ".*:" + s : s) |
| 6058 | + .map(Pattern::compile) |
| 6059 | + .collect(Collectors.toList()); |
| 6060 | + } |
| 6061 | + Optional<Pattern> found = this.patternsToSkip.stream() |
| 6062 | + .filter(pattern -> pattern.matcher(mavenProject.getGroupId() + ":" + mavenProject.getArtifactId()) |
| 6063 | + .matches()) |
| 6064 | + .findAny(); |
| 6065 | + return found.isPresent() || isSkippedJavadoc(mavenProject); |
6048 | 6066 | }
|
6049 | 6067 |
|
6050 | 6068 | /**
|
|
0 commit comments