o Refactored code

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@797479 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-07-24 14:23:45 +00:00
parent 4286488981
commit a48ae318c6
1 changed files with 17 additions and 16 deletions

View File

@ -122,14 +122,7 @@ public class DefaultMavenExecutionRequestPopulator
private void injectDefaultRepositories( MavenExecutionRequest request )
throws MavenEmbedderException
{
Set<String> definedRepositories = new HashSet<String>();
if ( request.getRemoteRepositories() != null )
{
for ( ArtifactRepository repository : request.getRemoteRepositories() )
{
definedRepositories.add( repository.getId() );
}
}
Set<String> definedRepositories = getRepoIds( request.getRemoteRepositories() );
if ( !definedRepositories.contains( RepositorySystem.DEFAULT_REMOTE_REPO_ID ) )
{
@ -147,14 +140,7 @@ public class DefaultMavenExecutionRequestPopulator
private void injectDefaultPluginRepositories( MavenExecutionRequest request )
throws MavenEmbedderException
{
Set<String> definedRepositories = new HashSet<String>();
if ( request.getPluginArtifactRepositories() != null )
{
for ( ArtifactRepository repository : request.getPluginArtifactRepositories() )
{
definedRepositories.add( repository.getId() );
}
}
Set<String> definedRepositories = getRepoIds( request.getPluginArtifactRepositories() );
if ( !definedRepositories.contains( RepositorySystem.DEFAULT_REMOTE_REPO_ID ) )
{
@ -169,6 +155,21 @@ public class DefaultMavenExecutionRequestPopulator
}
}
private Set<String> getRepoIds( List<ArtifactRepository> repositories )
{
Set<String> repoIds = new HashSet<String>();
if ( repositories != null )
{
for ( ArtifactRepository repository : repositories )
{
repoIds.add( repository.getId() );
}
}
return repoIds;
}
private void processRepositoriesInSettings( MavenExecutionRequest request )
throws MavenEmbedderException
{