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

com.hyf.hotrefresh.common.Version Maven / Gradle / Ivy

package com.hyf.hotrefresh.common;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author baB_hyf
 * @date 2022/05/20
 */
public class Version {

    public static final String DEFAULT_VERSION = "";
    public static final String VERSION_RESOURCE_PATH = "version.properties";

    public static String getVersion() {
        try (InputStream is = Version.class.getClassLoader().getResourceAsStream(VERSION_RESOURCE_PATH)) {
            if (is == null) {
                return DEFAULT_VERSION;
            }
            Properties properties = new Properties();
            properties.load(is);
            return properties.getProperty("version", DEFAULT_VERSION);
        } catch (IOException e) {
            return DEFAULT_VERSION;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy