From 5a2ef49f1dab7d061f493cbdbfe64ca6169a6c68 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Fri, 15 May 2009 21:52:10 +0000 Subject: [PATCH] o Fixed file:// URL handling git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@775363 13f79535-47bb-0310-9956-ffa450edef68 --- .../embedder/MavenEmbedderBehaviorTest.java | 4 ++-- .../repository/LegacyRepositorySystem.java | 17 +++++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderBehaviorTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderBehaviorTest.java index f567da76c5..c7c459476b 100644 --- a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderBehaviorTest.java +++ b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderBehaviorTest.java @@ -42,8 +42,8 @@ public class MavenEmbedderBehaviorTest MavenEmbedder maven = new MavenEmbedder( configuration ); - String expectedPath = ( new File( "/global/maven/local-repository" ) ).getCanonicalPath(); - String actualPath = maven.getLocalRepository().getBasedir(); + File expectedPath = new File( "/global/maven/local-repository" ).getCanonicalFile(); + File actualPath = new File( maven.getLocalRepository().getBasedir() ); assertEquals( expectedPath, actualPath ); maven.stop(); diff --git a/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java b/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java index 0f0d022b95..247df93cd4 100644 --- a/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java +++ b/maven-repository/src/main/java/org/apache/maven/repository/LegacyRepositorySystem.java @@ -191,18 +191,11 @@ public class LegacyRepositorySystem public ArtifactRepository createLocalRepository( File localRepository ) throws InvalidRepositoryException { - try - { - return createRepository( localRepository.toURI().toURL().toString(), - RepositorySystem.DEFAULT_LOCAL_REPO_ID, true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, - ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, - ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); - } - catch ( MalformedURLException e ) - { - throw new InvalidRepositoryException( "Error creating local repository.", RepositorySystem.DEFAULT_LOCAL_REPO_ID, e ); - } + return createRepository( "file://" + localRepository.toURI().getRawPath(), + RepositorySystem.DEFAULT_LOCAL_REPO_ID, true, + ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, true, + ArtifactRepositoryPolicy.UPDATE_POLICY_ALWAYS, + ArtifactRepositoryPolicy.CHECKSUM_POLICY_IGNORE ); } public ArtifactRepository createDefaultRemoteRepository()