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()