@@ -180,6 +180,14 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
180180 @ Parameter (defaultValue = "${session}" , readonly = true )
181181 protected MavenSession mavenSession ;
182182
183+ /**
184+ * Whether to update the <code>project.build.outputTimestamp</code> property automatically or not.
185+ *
186+ * @since 1.16.1
187+ */
188+ @ Parameter (property = "updateOutputTimestamp" , defaultValue = "true" )
189+ private boolean updateOutputTimestamp = true ;
190+
183191 @ Component
184192 protected ProjectBuilder projectBuilder ;
185193
@@ -1056,22 +1064,24 @@ protected void mvnSetVersions(final String version) throws MojoFailureException,
10561064 if (runCommand ) {
10571065 executeMvnCommand (args .toArray (new String [0 ]));
10581066
1059- String timestamp = getCurrentProjectOutputTimestamp ();
1060- if (timestamp != null && timestamp .length () > 1 ) {
1061- if (StringUtils .isNumeric (timestamp )) {
1062- // int representing seconds since the epoch
1063- timestamp = String .valueOf (System .currentTimeMillis () / 1000l );
1064- } else {
1065- // ISO-8601
1066- DateFormat df = new SimpleDateFormat ("yyyy-MM-dd'T'HH:mm:ss'Z'" );
1067- df .setTimeZone (TimeZone .getTimeZone ("UTC" ));
1068- timestamp = df .format (new Date ());
1067+ if (updateOutputTimestamp ) {
1068+ String timestamp = getCurrentProjectOutputTimestamp ();
1069+ if (timestamp != null && timestamp .length () > 1 ) {
1070+ if (StringUtils .isNumeric (timestamp )) {
1071+ // int representing seconds since the epoch
1072+ timestamp = String .valueOf (System .currentTimeMillis () / 1000l );
1073+ } else {
1074+ // ISO-8601
1075+ DateFormat df = new SimpleDateFormat ("yyyy-MM-dd'T'HH:mm:ss'Z'" );
1076+ df .setTimeZone (TimeZone .getTimeZone ("UTC" ));
1077+ timestamp = df .format (new Date ());
1078+ }
1079+
1080+ getLog ().info ("Updating property '" + REPRODUCIBLE_BUILDS_PROPERTY + "' to '" + timestamp + "'." );
1081+
1082+ executeMvnCommand (VERSIONS_MAVEN_PLUGIN_SET_PROPERTY_GOAL , "-DgenerateBackupPoms=false" ,
1083+ "-Dproperty=" + REPRODUCIBLE_BUILDS_PROPERTY , "-DnewVersion=" + timestamp );
10691084 }
1070-
1071- getLog ().info ("Updating property '" + REPRODUCIBLE_BUILDS_PROPERTY + "' to '" + timestamp + "'." );
1072-
1073- executeMvnCommand (VERSIONS_MAVEN_PLUGIN_SET_PROPERTY_GOAL , "-DgenerateBackupPoms=false" ,
1074- "-Dproperty=" + REPRODUCIBLE_BUILDS_PROPERTY , "-DnewVersion=" + timestamp );
10751085 }
10761086 }
10771087 }
0 commit comments