From acbcb48747ed6bd94249c2494b4953eea27f9d93 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 22 Oct 2017 17:01:27 +0200 Subject: [PATCH] Adding data path to configuration --- .../DefaultArchivaConfiguration.java | 15 ++++++-- .../src/main/mdo/configuration.mdo | 38 ++++++++----------- .../configuration/test-default-archiva.xml | 2 +- .../src/test/resources/scanner-archiva.xml | 2 +- .../src/test/resources/archiva-test.xml | 1 + .../src/test/resources/scanner-archiva.xml | 2 +- 6 files changed, 31 insertions(+), 29 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java index d31287d42..1dd0baeb2 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java @@ -202,16 +202,25 @@ public class DefaultArchivaConfiguration Registry subset = registry.getSubset( KEY ); if ( subset.getString( "version" ) == null ) { - // a little autodetection of v1, even if version is omitted (this was previously allowed) if ( subset.getSubset( "repositoryScanning" ).isEmpty() ) { - // only for empty, or v < 1 + // only for empty subset = readDefaultConfiguration(); + } else + { + throw new RuntimeException( "No version tag found in configuration. Archiva configuration version 1.x is not longer supported." ); } } Configuration config = new ConfigurationRegistryReader().read( subset ); - + if (StringUtils.isEmpty( config.getArchivaRuntimeConfiguration().getDataDirectory() )) { + Path appserverBaseDir = Paths.get(registry.getString("appserver.base", "")); + config.getArchivaRuntimeConfiguration().setDataDirectory( appserverBaseDir.normalize().toString() ); + } + if (StringUtils.isEmpty( config.getArchivaRuntimeConfiguration().getRepositoryBaseDirectory())) { + Path baseDir = Paths.get(config.getArchivaRuntimeConfiguration().getDataDirectory()); + config.getArchivaRuntimeConfiguration().setRepositoryBaseDirectory( baseDir.resolve("repositories").toString() ); + } config.getRepositoryGroups(); config.getRepositoryGroupsAsMap(); diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo index 971a83004..d5d96cda3 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo @@ -742,28 +742,6 @@ - - V1RepositoryConfiguration - 1.0.0+ - ManagedRepositoryConfiguration - - - url - 1.0.0+ - String - true - - The URL for this repository. - - - - indexed - 1.0.0+ - boolean - true - - - LegacyArtifactPath @@ -1552,6 +1530,20 @@ FileLockConfiguration + + dataDirectory + 3.0.0+ + The base directory where the archiva data is stored. If not set, the appserver.base is used. + String + false + + + repositoryBaseDirectory + 3.0.0+ + The base directory for local storage of repository data. If not set, it's ${dataDirectory}/repositories. + String + false + @@ -1559,7 +1551,7 @@ RedbackRuntimeConfiguration 1.4.0+ - The runtime configuration. + The redback runtime configuration. diff --git a/archiva-modules/archiva-base/archiva-configuration/src/test/resources/org/apache/archiva/configuration/test-default-archiva.xml b/archiva-modules/archiva-base/archiva-configuration/src/test/resources/org/apache/archiva/configuration/test-default-archiva.xml index ab0f50dbb..bb3d8034b 100755 --- a/archiva-modules/archiva-base/archiva-configuration/src/test/resources/org/apache/archiva/configuration/test-default-archiva.xml +++ b/archiva-modules/archiva-base/archiva-configuration/src/test/resources/org/apache/archiva/configuration/test-default-archiva.xml @@ -1,5 +1,5 @@ - 2 + 3.0.0 internal diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/scanner-archiva.xml b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/scanner-archiva.xml index 13a884e14..de6b2b62f 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/scanner-archiva.xml +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/test/resources/scanner-archiva.xml @@ -19,7 +19,7 @@ --> - + 3.0.0 diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/resources/archiva-test.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/resources/archiva-test.xml index 0c1f93c8f..277e287ef 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/resources/archiva-test.xml +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/resources/archiva-test.xml @@ -19,6 +19,7 @@ --> + 3.0.0 testRepo diff --git a/archiva-modules/plugins/maven2-repository/src/test/resources/scanner-archiva.xml b/archiva-modules/plugins/maven2-repository/src/test/resources/scanner-archiva.xml index 13a884e14..de6b2b62f 100644 --- a/archiva-modules/plugins/maven2-repository/src/test/resources/scanner-archiva.xml +++ b/archiva-modules/plugins/maven2-repository/src/test/resources/scanner-archiva.xml @@ -19,7 +19,7 @@ --> - + 3.0.0 -- 2.39.5