Skip to content

Commit 49e0ca3

Browse files
committed
Adds requested changes
1 parent baac146 commit 49e0ca3

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ public abstract class AbstractGitFlowMojo extends AbstractMojo {
181181
protected MavenSession mavenSession;
182182

183183
/**
184-
* Whether to update the <code>project.build.outputTimestamp</code>> property automatically or not.
184+
* Whether to update the <code>project.build.outputTimestamp</code> property automatically or not.
185185
*
186186
* @since 1.16.1
187187
*/
188-
@Parameter(property = "updateOutputTimestamp")
188+
@Parameter(property = "updateOutputTimestamp", defaultValue = "true")
189189
private boolean updateOutputTimestamp = true;
190190

191191
@Component
@@ -1064,22 +1064,24 @@ protected void mvnSetVersions(final String version) throws MojoFailureException,
10641064
if (runCommand) {
10651065
executeMvnCommand(args.toArray(new String[0]));
10661066

1067-
String timestamp = getCurrentProjectOutputTimestamp();
1068-
if (timestamp != null && timestamp.length() > 1 && updateOutputTimestamp) {
1069-
if (StringUtils.isNumeric(timestamp)) {
1070-
// int representing seconds since the epoch
1071-
timestamp = String.valueOf(System.currentTimeMillis() / 1000l);
1072-
} else {
1073-
// ISO-8601
1074-
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
1075-
df.setTimeZone(TimeZone.getTimeZone("UTC"));
1076-
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);
10771084
}
1078-
1079-
getLog().info("Updating property '" + REPRODUCIBLE_BUILDS_PROPERTY + "' to '" + timestamp + "'.");
1080-
1081-
executeMvnCommand(VERSIONS_MAVEN_PLUGIN_SET_PROPERTY_GOAL, "-DgenerateBackupPoms=false",
1082-
"-Dproperty=" + REPRODUCIBLE_BUILDS_PROPERTY, "-DnewVersion=" + timestamp);
10831085
}
10841086
}
10851087
}

0 commit comments

Comments
 (0)