repoGroupConf.getLocalStorage().setUrl(
env.getApplicationConfiguration().getWorkingDirectory("proxy/store/" + GROUP1_REPO_ID).toURI().toURL()
.toString());
Xpp3Dom exGroupRepo = new Xpp3Dom("externalConfiguration");
repoGroupConf.setExternalConfiguration(exGroupRepo);
M2GroupRepositoryConfiguration exGroupRepoConf = new M2GroupRepositoryConfiguration(exGroupRepo);
exGroupRepoConf.setMemberRepositoryIds(reposes);
exGroupRepoConf.setMergeMetadata(true);
group.configure(repoGroupConf);
env.getApplicationConfiguration().getConfigurationModel().addRepository(repoGroupConf);
env.getRepositoryRegistry().addRepository(group);
}
{
// add 2nd group
final M2GroupRepository group =
(M2GroupRepository) env.lookup(GroupRepository.class, "maven2");
CRepository repoGroupConf = new DefaultCRepository();
repoGroupConf.setProviderRole(GroupRepository.class.getName());
repoGroupConf.setProviderHint("maven2");
repoGroupConf.setId(GROUP2_REPO_ID);
repoGroupConf.setName(GROUP2_REPO_ID);
repoGroupConf.setLocalStorage(new CLocalStorage());
repoGroupConf.getLocalStorage().setProvider("file");
repoGroupConf.getLocalStorage().setUrl(
env.getApplicationConfiguration().getWorkingDirectory("proxy/store/" + GROUP2_REPO_ID).toURI().toURL()
.toString());
Xpp3Dom exGroupRepo = new Xpp3Dom("externalConfiguration");
repoGroupConf.setExternalConfiguration(exGroupRepo);
M2GroupRepositoryConfiguration exGroupRepoConf = new M2GroupRepositoryConfiguration(exGroupRepo);
exGroupRepoConf.setMemberRepositoryIds(Collections.singletonList(GROUP1_REPO_ID));
exGroupRepoConf.setMergeMetadata(true);
group.configure(repoGroupConf);
env.getApplicationConfiguration().getConfigurationModel().addRepository(repoGroupConf);
env.getRepositoryRegistry().addRepository(group);
}
}