diff --git a/Mage/src/main/java/mage/util/JarVersion.java b/Mage/src/main/java/mage/util/JarVersion.java index d88439c0a2..5c494ed13b 100644 --- a/Mage/src/main/java/mage/util/JarVersion.java +++ b/Mage/src/main/java/mage/util/JarVersion.java @@ -1,12 +1,13 @@ package mage.util; +import org.apache.log4j.Logger; + import java.net.URL; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAccessor; import java.util.jar.Attributes; import java.util.jar.Manifest; -import org.apache.log4j.Logger; /** * @author JayDi85 @@ -19,6 +20,7 @@ public class JarVersion { public static String getBuildTime(Class clazz) { // build time info inserted by maven on jar build phase (see root pom.xml) + String resultFormat = "uuuu-MM-dd HH:mm"; String className = clazz.getSimpleName() + ".class"; String classPath = clazz.getResource(className).toString(); @@ -38,10 +40,11 @@ public class JarVersion { Manifest manifest = new Manifest(new URL(manifestPath).openStream()); Attributes attr = manifest.getMainAttributes(); String buildTime = attr.getValue("Build-Time"); - DateTimeFormatter sourceFormatter = DateTimeFormatter.ofPattern("uuuuMMdd-HHmm").withZone(ZoneOffset.UTC); + // default maven format: yyyy-MM-dd'T'HH:mm:ss'Z' or see maven.build.timestamp.format in pom file + DateTimeFormatter sourceFormatter = DateTimeFormatter.ofPattern("uuuu-MM-dd'T'HH:mm:ss'Z'").withZone(ZoneOffset.UTC); TemporalAccessor ta = sourceFormatter.parse(buildTime); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm").withZone(ZoneOffset.UTC); - return formatter.format(ta); + DateTimeFormatter resultFormatter = DateTimeFormatter.ofPattern(resultFormat).withZone(ZoneOffset.UTC); + return resultFormatter.format(ta); } catch (Throwable e) { logger.error("Can't read build time in jar manifest for class " + clazz.getName() + " and path " + manifestPath, e); return JAR_BUILD_TIME_ERROR; diff --git a/pom.xml b/pom.xml index e4f8e8f1ee..c29fc8e2e1 100644 --- a/pom.xml +++ b/pom.xml @@ -90,6 +90,7 @@ 1.4.32 UTF-8 + yyyy-MM-dd'T'HH:mm:ss'Z'