- RepositoryConfig config;
- InputStream in = configuration.getInputStream();
- try {
- config = RepositoryConfig.create(in,
- homeDirectory.getCanonicalPath());
- } catch (Exception e) {
- throw new RuntimeException("Cannot read configuration", e);
- } finally {
- IOUtils.closeQuietly(in);
- }
+ RepositoryConfig config;
+ InputStream in = configuration.getInputStream();
+ InputStream propsIn = null;
+ try {
+ Properties vars = new Properties();
+ if (variables != null) {
+ propsIn = variables.getInputStream();
+ vars.load(propsIn);
+ }
+ // override with system properties
+ vars.putAll(System.getProperties());
+ vars.put(
+ RepositoryConfigurationParser.REPOSITORY_HOME_VARIABLE,
+ homeDirectory.getCanonicalPath());
+ config = RepositoryConfig.create(new InputSource(in), vars);
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot read configuration", e);
+ } finally {
+ IOUtils.closeQuietly(in);
+ IOUtils.closeQuietly(propsIn);
+ }