All Downloads are FREE. Search and download functionalities are using the official Maven repository.

r.josp.jcpGWs.2.2.0.source-code.BuildInfo Maven / Gradle / Ivy

There is a newer version: 2.2.3
Show newest version
package com.robypomper;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.util.Date;
import java.util.Map;
import java.io.InputStream;

public class BuildInfo {

    public final static BuildInfo current = load();
    
    public String project;
    public String sourceSet;
    public String version;
    public String versionBuild;
    public Date buildTime;
    public String javaVersion;
    public String javaHome;
    public String gradleVersion;
    public String gitCommit;
    public String gitCommitShort;
    public String gitBranch;
    public String user;
    public String osName;
    public String osVersion;
    public String osArch;
    public Map extra;

    private static BuildInfo load() {
        InputStream resource = Thread.currentThread().getContextClassLoader().getResourceAsStream("buildInfo.json");
        if (resource == null) {
            throw new IllegalArgumentException("File 'buildInfo.json' not found");
        }

        try {
            ObjectMapper mapper = new ObjectMapper();
            return mapper.readValue(resource, BuildInfo.class);
        } catch (IOException e) {
            throw new IllegalArgumentException("Error parsing file", e);
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy