KEYCLOAK-5138 Replace snapshot in resource version with build time (#4287)

This commit is contained in:
Stian Thorgersen 2017-07-04 10:52:29 +02:00 committed by GitHub
parent 32b16717a7
commit 1e6f099eb0
2 changed files with 11 additions and 0 deletions

View file

@ -45,6 +45,10 @@ public class Version {
Version.VERSION = props.getProperty("version");
Version.BUILD_TIME = props.getProperty("build-time");
Version.RESOURCES_VERSION = Version.VERSION.toLowerCase();
if (Version.RESOURCES_VERSION.endsWith("-snapshot")) {
Version.RESOURCES_VERSION = Version.RESOURCES_VERSION.replace("-snapshot", "-" + Version.BUILD_TIME.replace(" ", "").replace(":", "").replace("-", ""));
}
} catch (IOException e) {
Version.VERSION = Version.UNKNOWN;
Version.BUILD_TIME = Version.UNKNOWN;

View file

@ -27,6 +27,7 @@ import org.jboss.logging.Logger;
import org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher;
import org.jboss.resteasy.plugins.server.undertow.UndertowJaxrsServer;
import org.jboss.resteasy.spi.ResteasyDeployment;
import org.keycloak.common.Version;
import org.keycloak.connections.infinispan.InfinispanConnectionProvider;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
@ -45,6 +46,8 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@ -106,6 +109,10 @@ public class KeycloakServer {
}
public static void main(String[] args) throws Throwable {
if (!System.getenv().containsKey("MAVEN_CMD_LINE_ARGS")) {
Version.BUILD_TIME = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date());
}
bootstrapKeycloakServer(args);
}