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

com.tibco.bw.maven.plugin.build.BuildPropertiesParser Maven / Gradle / Ivy

Go to download

Plugin Code for Apache Maven and TIBCO BusinessWorks™. This is the Maven Plugin for BW6 and BWCE Build.

There is a newer version: 2.9.9
Show newest version
package com.tibco.bw.maven.plugin.build;

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

public class BuildPropertiesParser {
    public static final String BUILD_PROPERTIES = "build.properties";

    public static BuildProperties parse(File baseDir) {
        File propsFile = new File(baseDir, BUILD_PROPERTIES);
        Properties properties = readProperties(propsFile);
        BuildProperties buildProperties = new BuildPropertiesImpl(properties);
        return buildProperties;
    }

    protected static Properties readProperties(File propsFile) {
        Properties properties = new Properties();
        if(propsFile.canRead()) {
            // TODO should we fail the build if build.properties is missing?
            InputStream is = null;
            try {
                try {
                    is = new FileInputStream(propsFile);
                    properties.load(is);
                } finally {
                    if (is != null) {
                        is.close();
                    }
                }
            } catch(IOException e) {
                // ignore
            }
        }
        return properties;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy