Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pgp-keys-map.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: <project.build.outputTimestamp>"
+ new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX").format(new Date())
+ "</project.build.outputTimestamp>");
return true;
}
}

if (log.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<CharSequence> 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());
}
}