Skip to content
Permalink
Browse files

add build year

  • Loading branch information...
erilong committed Mar 14, 2019
1 parent 7854368 commit 29bf68ae6e35b7fa5bc6178a03ebc728eaac6d29
@@ -79,5 +79,9 @@ public static boolean isOlderMinorVersion(int[] checkVersion, int[] targetVersio
public static long getBuildTime() {
return version.getBuildTime();
}

public static String getBuildYear() {
return version.getBuildYear();
}

}
@@ -47,6 +47,8 @@
private String version = null;

private long buildTime = -1;

private String buildYear;

abstract protected String getArtifactName();

@@ -101,6 +103,18 @@ public long getBuildTime() {
return buildTime;
}

public String getBuildYear() {
if (buildYear == null) {
Attributes attributes = findManifestAttributes();
try {
buildYear = attributes.getValue("Build-Time").substring(0, 4);
} catch (Exception e) {
buildYear = "";
}
}
return buildYear;
}

public String versionWithUnderscores() {
return version().replace("[\\.\\-]", "_");
}

0 comments on commit 29bf68a

Please sign in to comment.
You can’t perform that action at this time.