KieServices kieServices = KieServices.Factory.get();
ReleaseId releaseId = Containers.toReleaseId("org.switchyard.tmp", "app", String.valueOf(VERSION_COUNT.incrementAndGet()));
KieFileSystem kieFileSystem = kieServices.newKieFileSystem().generateAndWritePomXML(releaseId);
Resources.addResources(getModel(), getLoader(), kieFileSystem);
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll();
Results results = kieBuilder.getResults();
if (results.hasMessages(Message.Level.ERROR)) {
StringBuilder sb = new StringBuilder(CommonKnowledgeMessages.MESSAGES.problemBuildingKnowledge());
for (Message message : results.getMessages(Message.Level.ERROR)) {
sb.append(LINE_SEPARATOR);
sb.append(message.toString().trim());
}
throw new SwitchYardException(sb.toString());
}