diff --git a/pgp-keys-map.list b/pgp-keys-map.list
index 5e0a25e..845c71a 100644
--- a/pgp-keys-map.list
+++ b/pgp-keys-map.list
@@ -21,9 +21,17 @@ javax.inject:javax.inject = noSig
org.apache.maven.* = 0xB920D295BF0E61CB4CF0896C33CD6733AF5EC452
org.apache.maven:maven-archiver = 0x29BEA2A645F2D6CED7FB12E02B172E3E156466E8
org.apache.maven.shared:maven-shared-utils = 0x84789D24DF77A32433CE1F079EB80E92EB2135B1
+org.apiguardian:apiguardian-api:1.1.2 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.codehaus.plexus:plexus-archiver = 0x29BEA2A645F2D6CED7FB12E02B172E3E156466E8
org.codehaus.plexus:plexus-interpolation = 0x47063E8BA7A6450E4A52E7AE466CAED6E0747D50
org.codehaus.plexus:plexus-io = 0xF254B35617DC255D9344BCFA873A8E86B4372146
org.codehaus.plexus:plexus-utils = 0xEA23DB1360D9029481E7F2EFECDFEA3CB4493B94
org.codehaus.plexus:plexus-xml = 0xFA77DCFEF2EE6EB2DEBEDD2C012579464D01C06A
+org.junit.jupiter:junit-jupiter:5.10.2 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.jupiter:junit-jupiter-api:5.10.2 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.jupiter:junit-jupiter-engine:5.10.2 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.jupiter:junit-jupiter-params:5.10.2 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.platform:junit-platform-commons:1.10.2 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.junit.platform:junit-platform-engine:1.10.2 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
+org.opentest4j:opentest4j:1.3.0 = 0xFF6E2C001948C5F2F38B0CC385911F425EC61B51
org.slf4j:slf4j-api = 0x475F3B8E59E6E63AA78067482C7B12F2A511E325
diff --git a/pom.xml b/pom.xml
index 1637163..6c69006 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,6 +135,12 @@
maven-plugin-annotations
provided
+
+ org.junit.jupiter
+ junit-jupiter
+ 5.10.2
+ test
+
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 2c0b632..69fa250 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
@@ -166,9 +166,18 @@ static boolean hasBadOutputTimestamp(
MavenArchiver archiver = new MavenArchiver();
Date timestamp = archiver.parseOutputTimestamp(outputTimestamp);
if (timestamp == null) {
- log.error("Reproducible Build not activated by project.build.outputTimestamp property: "
- + "see https://maven.apache.org/guides/mini/guide-reproducible-builds.html");
- return true;
+ // try to resolve it at runtime - injected from a property
+ String injected = project.getProperties().getProperty("project.build.outputTimestamp");
+ if (injected != null) {
+ log.info("project.build.outputTimestamp is injected by the build");
+ } else {
+ log.error("Reproducible Build not activated by project.build.outputTimestamp property: "
+ + "see https://maven.apache.org/guides/mini/guide-reproducible-builds.html, "
+ + "ex: "
+ + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX").format(new Date())
+ + "");
+ return true;
+ }
}
if (log.isDebugEnabled()) {
diff --git a/src/test/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojoTest.java b/src/test/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojoTest.java
new file mode 100644
index 0000000..349e12e
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugins/artifact/buildinfo/AbstractBuildinfoMojoTest.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.plugins.artifact.buildinfo;
+
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.apache.maven.model.Model;
+import org.apache.maven.monitor.logging.DefaultLog;
+import org.apache.maven.project.MavenProject;
+import org.junit.jupiter.api.Test;
+
+import static java.util.Collections.emptyList;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class AbstractBuildinfoMojoTest {
+ @Test
+ void detectInjectedTimestamp() {
+ final Model model = new Model();
+ final MavenProject project = new MavenProject();
+ project.setOriginalModel(model);
+ project.getProperties().setProperty("project.build.outputTimestamp", "set");
+ model.setProperties(project.getProperties());
+
+ final AtomicReference message = new AtomicReference<>();
+ AbstractBuildinfoMojo.hasBadOutputTimestamp(
+ null,
+ new DefaultLog(null) {
+ @Override
+ public boolean isDebugEnabled() {
+ return false;
+ }
+
+ @Override
+ public void info(final CharSequence content) {
+ if (message.get() == null) {
+ message.set(content);
+ } else {
+ throw new IllegalStateException(content + " can't be set cause it is unexpected");
+ }
+ }
+ },
+ project,
+ emptyList());
+
+ assertEquals("project.build.outputTimestamp is injected by the build", message.get());
+ }
+}