File remoteRepoDir = findRemoteRepositoryDirectory();
File localRepo = createTempDir();
List<ArtifactRepository> remoteRepositories = new ArrayList<ArtifactRepository>();
remoteRepositories.add( repoFactory.createArtifactRepository( "central", remoteRepoDir.toURI().toURL()
.toExternalForm(), new DefaultRepositoryLayout(), null, null ) );
mojo.setRemoteRepos( remoteRepositories );
DefaultArtifactRepository localRepository = new DefaultArtifactRepository( "local",
localRepo.getAbsolutePath(), new DefaultRepositoryLayout() );
localRepository.setBasedir( localRepo.getAbsolutePath() );
mojo.setLocal( localRepository );
mojo.execute();