mirror of https://github.com/apache/maven.git
o Fixed bad protocol & basedir after mirroring
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@803057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
497a490d0f
commit
483a0d1f90
|
@ -187,18 +187,11 @@ public class MavenArtifactRepository
|
|||
public void setUrl( String url )
|
||||
{
|
||||
this.url = url;
|
||||
|
||||
this.protocol = protocol( url );
|
||||
this.basedir = basedir( url );
|
||||
}
|
||||
|
||||
public void setBasedir( String basedir )
|
||||
{
|
||||
this.basedir = basedir;
|
||||
}
|
||||
|
||||
public void setProtocol( String protocol )
|
||||
{
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
// Path Utils
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package org.apache.maven.repository;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
|
@ -172,7 +175,20 @@ public class MirrorProcessorTest
|
|||
assertFalse( mirrorBuilder.matchPattern( getRepo( "c", "http://localhost" ), "!a,external:*" ) );
|
||||
assertTrue( mirrorBuilder.matchPattern( getRepo( "c", "http://somehost" ), "!a,external:*" ) );
|
||||
}
|
||||
|
||||
|
||||
public void testMirrorProperUrlAndProtocolAndBasedir()
|
||||
{
|
||||
mirrorBuilder.addMirror( "mirror-id", "central", "file:///tmp", null );
|
||||
|
||||
List<ArtifactRepository> repos = Arrays.asList( getRepo( "central", "http://repo1.maven.org" ) );
|
||||
repos = mirrorBuilder.getMirrors( repos );
|
||||
|
||||
ArtifactRepository repo = repos.get( 0 );
|
||||
assertEquals( "file:///tmp", repo.getUrl() );
|
||||
assertEquals( "file", repo.getProtocol() );
|
||||
assertEquals( "/tmp", repo.getBasedir() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an ArtifactRepository object.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue