BeanManager beanManager = CDIUtils.lookUpBeanManager(ctx);
logger.debug("BeanManager " + beanManager);
POMService pomService = CDIUtils.createBean(POMService.class, beanManager);
logger.debug("POMService " + pomService);
IOService ioService = CDIUtils.createBean(IOService.class, beanManager, new NamedLiteral("ioStrategy"));
logger.debug("IoService " + ioService);
if (ioService != null) {
ProjectService projectService = CDIUtils.createBean(ProjectService.class, beanManager);
RepositoryService repositoryService = CDIUtils.createBean(RepositoryService.class, beanManager);
logger.debug("RepositoryService " + repositoryService);
if (repositoryService != null) {
Repository repo = repositoryService.getRepository(repository);
Map<String, Object> config = new HashMap<String, Object>();
config.put("branch", branchToUpdate + "-" + version);
repo = repositoryService.updateRepository(repo, config);
logger.debug("Updated repository " + repo);
// update all pom.xml files of projects on the dev branch
Set<Project> projects = getProjects(repo, ioService, projectService);
for (Project project : projects) {
POM pom = pomService.load(project.getPomXMLPath());
pom.getGav().setVersion(version);
pomService.save(project.getPomXMLPath(), pom, null, "Update project version on development branch");
executionResults.setData(project.getProjectName() + "-GAV", pom.getGav().toString());
}
}
}