diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java index 21e6529..3fadd63 100644 --- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java +++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/DescribeBuildOutputMojo.java @@ -25,7 +25,10 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; +import java.util.Comparator; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import org.apache.commons.codec.digest.DigestUtils; import org.apache.maven.RepositoryUtils; @@ -58,8 +61,25 @@ private void describeBuildOutput() throws MojoExecutionException { rootPath = getExecutionRoot().getBasedir().toPath(); bi = newBuildInfoWriter(null, false); + Map groupIds = session.getProjects().stream() + .collect(Collectors.groupingBy(MavenProject::getGroupId, Collectors.counting())); + groupIds.entrySet().stream() + .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())) + .forEach(e -> getLog().info("groupId: " + e.getKey() + " (" + e.getValue() + " artifactId" + + ((e.getValue() > 1) ? "s" : "") + ")")); + + Map> artifactIds = session.getProjects().stream() + .collect(Collectors.groupingBy( + MavenProject::getArtifactId, Collectors.mapping(MavenProject::getGroupId, Collectors.toSet()))); + artifactIds.entrySet().stream() + .sorted(Map.Entry.comparingByKey()) + .filter(e -> e.getValue().size() > 1) + .forEach(e -> + getLog().info("artifactId: " + e.getKey() + " defined for multiple groupIds: " + e.getValue())); + + getLog().info(""); getLog().info(MessageUtils.buffer() - .a("skip/ignore artifactId") + .a("skip/ignore? artifactId") .strong("[:classifier][:extension]") .a(" = build-path repository-filename size [sha256]") .build()); @@ -92,11 +112,11 @@ private void describeBuildOutput() throws MojoExecutionException { } } pomArtifact = pomArtifact.setFile(p.getFile()); - getLog().info(s + describeArtifact(pomArtifact)); + getLog().info(s + describeArtifact(pomArtifact, skipped)); // main artifact (when available: pom packaging does not provide main artifact) if (p.getArtifact().getFile() != null) { - getLog().info(s + describeArtifact(RepositoryUtils.toArtifact(p.getArtifact()))); + getLog().info(s + describeArtifact(RepositoryUtils.toArtifact(p.getArtifact()), skipped)); } // attached artifacts (when available) @@ -107,7 +127,7 @@ private void describeBuildOutput() throws MojoExecutionException { } boolean ignored = skipped ? false : isIgnore(a); String i = skipped ? s : (ignored ? "RB-ignored " : " "); - getLog().info(i + describeArtifact(a, ignored)); + getLog().info(i + describeArtifact(a, skipped || ignored)); } } }