Skip to content

Commit 94e991c

Browse files
committed
clarify auto-detect skip vs skipModules
1 parent 066a558 commit 94e991c

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,12 @@ public void execute() throws MojoExecutionException {
160160

161161
if (!mono) {
162162
// if module skips install and/or deploy
163-
if (isSkip(project)) {
164-
getLog().info("Skipping goal because module skips install and/or deploy");
163+
if (detectSkip && PluginUtil.isSkip(project)) {
164+
getLog().info("Auto-skipping goal because module skips install and/or deploy");
165+
return;
166+
}
167+
if (isSkipModule(project)) {
168+
getLog().info("Skipping goal for module");
165169
return;
166170
}
167171
// if multi-module build, generate (aggregate) buildinfo only in last module
@@ -384,20 +388,21 @@ private MavenProject getLastProject() {
384388
}
385389

386390
protected boolean isSkip(MavenProject project) {
387-
// manual/configured module skip
388-
boolean skipModule = false;
389-
if (skipModules != null && !skipModules.isEmpty()) {
390-
if (skipModulesMatcher == null) {
391-
FileSystem fs = FileSystems.getDefault();
392-
skipModulesMatcher = skipModules.stream()
393-
.map(i -> fs.getPathMatcher("glob:" + i))
394-
.collect(Collectors.toList());
395-
}
396-
Path path = Paths.get(project.getGroupId() + '/' + project.getArtifactId());
397-
skipModule = skipModulesMatcher.stream().anyMatch(m -> m.matches(path));
391+
return isSkipModule(project) || (detectSkip && PluginUtil.isSkip(project));
392+
}
393+
394+
protected boolean isSkipModule(MavenProject project) {
395+
if (skipModules == null || skipModules.isEmpty()) {
396+
return false;
397+
}
398+
if (skipModulesMatcher == null) {
399+
FileSystem fs = FileSystems.getDefault();
400+
skipModulesMatcher = skipModules.stream()
401+
.map(i -> fs.getPathMatcher("glob:" + i))
402+
.collect(Collectors.toList());
398403
}
399-
// detected skip
400-
return skipModule || (detectSkip && PluginUtil.isSkip(project));
404+
Path path = Paths.get(project.getGroupId() + '/' + project.getArtifactId());
405+
return skipModulesMatcher.stream().anyMatch(m -> m.matches(path));
401406
}
402407

403408
private Toolchain getToolchain() {

src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private void describeBuildOutput() throws MojoExecutionException {
122122

123123
for (MavenProject p : session.getProjects()) {
124124
boolean skipped = isSkip(p);
125-
String s = skipped ? "not-deployed " : " ";
125+
String s = skipped ? (isSkipModule(p) ? "skipped " : "not-deployed ") : " ";
126126

127127
// project = pom
128128
// detect Maven 4 consumer POM transient attachment

0 commit comments

Comments
 (0)