Refactor getLocalRepository() in tests by using the repositorySystem

This commit is contained in:
rfscholte 2020-02-29 21:01:24 +01:00
parent 9ae008a67d
commit f2e9afd788
2 changed files with 2 additions and 11 deletions

View File

@ -23,7 +23,6 @@ import java.net.URL;
import java.util.Arrays;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.model.building.ModelBuildingException;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.repository.RepositorySystem;
@ -119,11 +118,7 @@ public abstract class AbstractMavenProjectTestCase
protected ArtifactRepository getLocalRepository()
throws Exception
{
ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
ArtifactRepository r = repositorySystem.createArtifactRepository( "local", "file://" + getLocalRepositoryPath().getAbsolutePath(), repoLayout, null, null );
return r;
return repositorySystem.createLocalRepository( getLocalRepositoryPath() );
}
// ----------------------------------------------------------------------

View File

@ -198,11 +198,7 @@ public class DefaultMavenProjectBuilderTest
protected ArtifactRepository getLocalRepository()
throws Exception
{
ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "default" );
ArtifactRepository r =
repositorySystem.createArtifactRepository( "local", "file://" + localRepoDir.getAbsolutePath(), repoLayout,
null, null );
return r;
return repositorySystem.createLocalRepository( getLocalRepositoryPath() );
}
public void xtestLoop()