String projectUri = "default://"+branchToBuild+"@"+uri;
BeanManager beanManager = CDIUtils.lookUpBeanManager(ctx);
logger.debug("BeanManager " + beanManager);
BuildService buildService = CDIUtils.createBean(BuildService.class, beanManager);
logger.debug("BuildService " + buildService);
IOService ioService = CDIUtils.createBean(IOService.class, beanManager, new NamedLiteral("ioStrategy"));
logger.debug("IoService " + ioService);
if (ioService != null) {
Path projectPath = ioService.get(URI.create(projectUri));
logger.debug("Project path is " + projectPath);
ProjectService projectService = CDIUtils.createBean(ProjectService.class, beanManager);
Project project = projectService.resolveProject(Paths.convert(projectPath));
if (project == null) {
throw new IllegalArgumentException("Unable to find project " + projectUri);
}
BuildResults results = buildService.build(project);
// dump to debug if enabled
if (logger.isDebugEnabled()) {
logger.debug("Errors " + results.getErrorMessages().size());
logger.debug("Warnings " + results.getWarningMessages().size());
logger.debug("Info " + results.getInformationMessages().size());