Java Properties Load from File loadBuildProperties(File projectRootDir)

Here you can find the source of loadBuildProperties(File projectRootDir)

Description

load Build Properties

License

Open Source License

Declaration

public static Properties loadBuildProperties(File projectRootDir) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008, 2011 Sonatype Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*  ww  w  .j  av a2 s  .  c om*/
 *    Sonatype Inc. - initial API and implementation
 *******************************************************************************/

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

public class Main {
    public static Properties loadBuildProperties(File projectRootDir) {
        File file = new File(projectRootDir, "build.properties");

        Properties buildProperties = new Properties();
        if (file.canRead()) {
            InputStream is = null;
            try {
                try {
                    is = new FileInputStream(file);
                    buildProperties.load(is);
                } finally {
                    if (is != null)
                        is.close();
                }
            } catch (Exception e) {
                // ignore
            }
        }

        return buildProperties;
    }
}

Related

  1. load(String resource)
  2. load(String resource)
  3. load(String[] paths, String fileName)
  4. loadAccessTokenProperties( InputStream inputStream)
  5. loadApiProperties(InputStream inputStream)
  6. loadCfg(String url)
  7. loadConfig(File settingsFile)
  8. loadConfigByPath(String path)
  9. loadConfigProperties()