config.setSettings(new MavenSettingsImpl(config.getSettingsFileUrl(), config.useFallbackRepositories()));
DownloadManager dm = new DownloadManager(config, Executors.newSingleThreadExecutor());
final CountDownLatch latch = new CountDownLatch(1);
final DownloadFuture df = dm.download(String.format("mvn:%s/%s/%s", archetype.groupId, archetype.artifactId, archetype.version));
df.addListener(new FutureListener<DownloadFuture>() {
@Override
public void operationComplete(DownloadFuture future) {
latch.countDown();
}
});