File tree Expand file tree Collapse file tree 4 files changed +67
-1
lines changed
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src
java/org/springframework/boot/maven
projects/build-info-reproducible-epochseconds
main/java/org/springframework/boot/maven Expand file tree Collapse file tree 4 files changed +67
-1
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,16 @@ void generatedBuildInfoReproducible(MavenBuild mavenBuild) {
8383 .hasBuildTime ("2021-04-21T11:22:33Z" )));
8484 }
8585
86+ @ TestTemplate
87+ void generatedBuildInfoReproducibleEpochSeconds (MavenBuild mavenBuild ) {
88+ mavenBuild .project ("build-info-reproducible-epochseconds" )
89+ .execute (buildInfo ((buildInfo ) -> assertThat (buildInfo ).hasBuildGroup ("org.springframework.boot.maven.it" )
90+ .hasBuildArtifact ("build-reproducible-epochseconds" )
91+ .hasBuildName ("Generate build info with build time from project.build.outputTimestamp" )
92+ .hasBuildVersion ("0.0.1.BUILD-SNAPSHOT" )
93+ .hasBuildTime ("1976-01-09T12:00:00Z" )));
94+ }
95+
8696 @ TestTemplate
8797 void buildInfoPropertiesAreGeneratedToCustomOutputLocation (MavenBuild mavenBuild ) {
8898 mavenBuild .project ("build-info-custom-file" )
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
4+ <modelVersion >4.0.0</modelVersion >
5+ <groupId >org.springframework.boot.maven.it</groupId >
6+ <artifactId >build-reproducible-epochseconds</artifactId >
7+ <version >0.0.1.BUILD-SNAPSHOT</version >
8+ <name >Generate build info with build time from project.build.outputTimestamp</name >
9+ <properties >
10+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
11+ <maven .compiler.source>@java.version@</maven .compiler.source>
12+ <maven .compiler.target>@java.version@</maven .compiler.target>
13+ <!-- Epoch seconds should be support bey build-info plugin too -->
14+ <project .build.outputTimestamp>190036800</project .build.outputTimestamp>
15+ </properties >
16+ <build >
17+ <plugins >
18+ <plugin >
19+ <groupId >@project.groupId@</groupId >
20+ <artifactId >@project.artifactId@</artifactId >
21+ <version >@project.version@</version >
22+ <executions >
23+ <execution >
24+ <goals >
25+ <goal >build-info</goal >
26+ </goals >
27+ </execution >
28+ </executions >
29+ </plugin >
30+ </plugins >
31+ </build >
32+ </project >
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2012-2024 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package org .test ;
18+
19+ public class SampleApplication {
20+
21+ public static void main (String [] args ) {
22+ }
23+
24+ }
Original file line number Diff line number Diff line change @@ -154,7 +154,7 @@ private Instant getBuildTime() {
154154 if ("off" .equalsIgnoreCase (this .time )) {
155155 return null ;
156156 }
157- return Instant . parse (this .time );
157+ return new MavenBuildOutputTimestamp (this .time ). toInstant ( );
158158 }
159159
160160}
You can’t perform that action at this time.
0 commit comments