From edddb43b5a7b6ea5bc47829465a80ce22abcd858 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Boutemy?= Date: Tue, 15 Oct 2024 02:02:17 +0200 Subject: [PATCH] [MARTIFACT-67] track Maven 4 -build.pom --- .../artifact/buildinfo/BuildInfoWriter.java | 14 ++++++++++++++ .../buildinfo/DescribeBuildOutputMojo.java | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java index 57257dc..20871c4 100644 --- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java +++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/BuildInfoWriter.java @@ -191,6 +191,20 @@ void printArtifacts(MavenProject project) throws MojoExecutionException { pomArtifact.getFile(), project.getArtifactId() + '-' + project.getVersion() + ".pom"); + if (consumerPom != null) { + // build pom + Artifact buildPomArtifact = new DefaultArtifact( + project.getGroupId(), project.getArtifactId(), "build", "pom", project.getVersion()); + buildPomArtifact = buildPomArtifact.setFile(project.getFile()); + + artifacts.put(buildPomArtifact, prefix + n); + printFile( + prefix + n++, + buildPomArtifact.getGroupId(), + buildPomArtifact.getFile(), + project.getArtifactId() + '-' + project.getVersion() + "-build.pom"); + } + if (project.getArtifact() == null) { return; } 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 9e13dd8..21e6529 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 @@ -37,7 +37,7 @@ import org.eclipse.aether.artifact.DefaultArtifact; /** - * Describe build output. + * Describe build output (experimental). * It is expected to be used aggregator used from CLI, ie run at root after everything has run, but not bound to any build * phase, where it would be run at root before modules. * @since 3.5.2