diff --git a/src/it/check-buildplan-ok/invoker.properties b/src/it/check-buildplan-ok/invoker.properties index f2191ac..e3de0b3 100644 --- a/src/it/check-buildplan-ok/invoker.properties +++ b/src/it/check-buildplan-ok/invoker.properties @@ -15,4 +15,4 @@ # specific language governing permissions and limitations # under the License. -invoker.goals=artifact:check-buildplan +invoker.goals=artifact:check-buildplan -Ddiagnose diff --git a/src/it/check-buildplan-ok/pom.xml b/src/it/check-buildplan-ok/pom.xml index 01a0ac3..9ea0566 100644 --- a/src/it/check-buildplan-ok/pom.xml +++ b/src/it/check-buildplan-ok/pom.xml @@ -26,7 +26,7 @@ pom - 2011-11-11T11:11:11Z + 0 diff --git a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java index 5977cbb..3dc6b6f 100644 --- a/src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java +++ b/src/main/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojo.java @@ -172,10 +172,11 @@ static boolean hasBadOutputTimestamp( boolean diagnose) { Instant timestamp = MavenArchiver.parseBuildOutputTimestamp(outputTimestamp).orElse(null); + String effective = ((timestamp == null) ? "disabled" : DateTimeFormatter.ISO_INSTANT.format(timestamp)); if (diagnose) { - log.info("outputTimestamp = " + outputTimestamp + " => " - + ((timestamp == null) ? "disabled" : DateTimeFormatter.ISO_INSTANT.format(timestamp))); + log.info("outputTimestamp = " + outputTimestamp + + (effective.equals(outputTimestamp) ? "" : (" => " + effective))); String projectProperty = project.getProperties().getProperty("project.build.outputTimestamp"); String modelProperty = project.getModel().getProperties().getProperty("project.build.outputTimestamp"); @@ -185,11 +186,29 @@ static boolean hasBadOutputTimestamp( log.info("plugin outputTimestamp parameter diagnostics:" + System.lineSeparator() + " - plugin outputTimestamp parameter (defaultValue=\"${project.build.outputTimestamp}\") = " + outputTimestamp + System.lineSeparator() - + " - project project.build.outputTimestamp property = " + projectProperty + + " - project.build.outputTimestamp property from project = " + projectProperty + System.lineSeparator() - + " - model project.build.outputTimestamp property = " + modelProperty + + " - project.build.outputTimestamp property from project model = " + modelProperty + System.lineSeparator() - + " - original model project.build.outputTimestamp property = " + originalModelProperty); + + " - project.build.outputTimestamp property from project original model = " + + originalModelProperty); + + MavenProject parent = project.getParent(); + if (parent != null) { + StringBuilder sb = new StringBuilder("Inheritance analysis property:" + System.lineSeparator() + + " - current " + project.getId() + " property = " + projectProperty); + while (parent != null) { + String parentProperty = parent.getProperties().getProperty("project.build.outputTimestamp"); + sb.append(System.lineSeparator()); + sb.append(" - parent " + (reactorProjects.contains(parent) ? "in reactor " : "") + + parent.getId() + " property = " + parentProperty); + if (!projectProperty.equals(parentProperty)) { + break; + } + parent = parent.getParent(); + } + log.info(sb.toString()); + } } if (timestamp == null) { @@ -209,7 +228,7 @@ static boolean hasBadOutputTimestamp( if (log.isDebugEnabled()) { log.debug("project.build.outputTimestamp = \"" + outputTimestamp + "\" => " - + DateTimeFormatter.ISO_INSTANT.format(timestamp)); + + (effective.equals(outputTimestamp) ? "" : (" => " + effective))); } // check if timestamp defined in a project from reactor: warn if it is not the case