File tree Expand file tree Collapse file tree 2 files changed +27
-9
lines changed
src/main/java/org/apache/maven/archiver Expand file tree Collapse file tree 2 files changed +27
-9
lines changed Original file line number Diff line number Diff line change 115115 <scope >test</scope >
116116 </dependency >
117117 </dependencies >
118+
119+ <build >
120+ <pluginManagement >
121+ <plugins >
122+ <plugin >
123+ <groupId >org.apache.maven.plugins</groupId >
124+ <artifactId >maven-surefire-plugin</artifactId >
125+ <configuration >
126+ <redirectTestOutputToFile >true</redirectTestOutputToFile >
127+ <excludedEnvironmentVariables >
128+ <excludedEnvironmentVariable >SOURCE_DATE_EPOCH</excludedEnvironmentVariable >
129+ </excludedEnvironmentVariables >
130+ </configuration >
131+ </plugin >
132+ </plugins >
133+ </pluginManagement >
134+ </build >
135+
118136</project >
Original file line number Diff line number Diff line change @@ -755,9 +755,15 @@ public Date configureReproducible(String outputTimestamp) {
755755 * section 4.4.6.
756756 */
757757 public static Optional <Instant > parseBuildOutputTimestamp (String outputTimestamp ) {
758- // Fail-fast on nulls
759- if (outputTimestamp == null ) {
760- return Optional .empty ();
758+ final String sourceDateEpoch = System .getenv ("SOURCE_DATE_EPOCH" );
759+ // Fail fast on null and no timestamp configured (1 character configuration is useful to override
760+ // a full value during pom inheritance)
761+ if (outputTimestamp == null || (outputTimestamp .length () < 2 && !isNumeric (outputTimestamp ))) {
762+ if (sourceDateEpoch == null ) {
763+ return Optional .empty ();
764+ } else {
765+ outputTimestamp = sourceDateEpoch ;
766+ }
761767 }
762768
763769 // Number representing seconds since the epoch
@@ -771,12 +777,6 @@ public static Optional<Instant> parseBuildOutputTimestamp(String outputTimestamp
771777 return Optional .of (date );
772778 }
773779
774- // no timestamp configured (1 character configuration is useful to override a full value during pom
775- // inheritance)
776- if (outputTimestamp .length () < 2 ) {
777- return Optional .empty ();
778- }
779-
780780 try {
781781 // Parse the date in UTC such as '2011-12-03T10:15:30Z' or with an offset '2019-10-05T20:37:42+06:00'.
782782 final Instant date = OffsetDateTime .parse (outputTimestamp )
You can’t perform that action at this time.
0 commit comments