From f34d32f93cab134f010154769d9b01dbaeb2ebba Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 19 Oct 2012 16:48:56 +0000 Subject: [PATCH] take of relative path in configuration file git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1400162 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultManagedRepositoryAdmin.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java index b28b7435a..938c95396 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java @@ -556,6 +556,22 @@ public class DefaultManagedRepositoryAdmin public IndexingContext createIndexContext( ManagedRepository repository ) throws RepositoryAdminException { + + // take care first about repository location as can be relative + File repositoryDirectory = new File( repository.getLocation() ); + + if ( !repositoryDirectory.isAbsolute() ) + { + repositoryDirectory = + new File( getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories", + repository.getLocation() ); + } + + if ( !repositoryDirectory.exists() ) + { + repositoryDirectory.mkdirs(); + } + try { @@ -585,10 +601,7 @@ public class DefaultManagedRepositoryAdmin indexDirectory = new File( managedRepository, ".indexer" ); if ( !managedRepository.isAbsolute() ) { - indexDirectory = new File( - getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories" - + File.separatorChar + - repository.getLocation(), ".indexer" ); + indexDirectory = new File( repositoryDirectory, ".indexer" ); repository.setIndexDirectory( indexDirectory.getAbsolutePath() ); } }