@Override public void buildAndDeploy( final Path pathToPom ) { //Build final BuildResults results = doBuild( pathToPom ); buildResultsEvent.fire( results ); //Deploy, if no errors if ( results.getMessages().isEmpty() ) { final POM pom = pomService.load( pathToPom ); final Builder builder = cache.assertBuilder( pathToPom ); final InternalKieModule kieModule = (InternalKieModule) builder.getKieModule(); final ByteArrayInputStream input = new ByteArrayInputStream( kieModule.getBytes() ); m2RepoService.deployJar( input, pom.getGav() ); } }
public BuildResults build() { //KieBuilder is not re-usable for successive "full" builds kieBuilder = kieServices.newKieBuilder( kieFileSystem ); final Results kieResults = kieBuilder.buildAll().getResults(); final BuildResults results = convertMessages( kieResults ); if ( !results.getMessages().isEmpty() ) { return results; } kieContainer = kieServices.newKieContainer( kieBuilder.getKieModule().getReleaseId() ); //Check external imports are available. These are loaded when a DMO is requested, but it's better to report them early final org.kie.commons.java.nio.file.Path nioExternalImportsPath = moduleDirectory.resolve( "project.imports" ); if ( Files.exists( nioExternalImportsPath ) ) { final org.uberfire.backend.vfs.Path externalImportsPath = paths.convert( nioExternalImportsPath ); final PackageConfiguration packageConfiguration = projectService.load( externalImportsPath ); final Imports imports = packageConfiguration.getImports(); for ( final Import item : imports.getImports() ) { try { Class clazz = this.getClass().getClassLoader().loadClass( item.getType() ); } catch ( ClassNotFoundException cnfe ) { results.addBuildMessage( makeMessage( ERROR_CLASS_NOT_FOUND, cnfe ) ); } } } return results; }
@Test public void testBuilderSimpleKProject() throws Exception { Paths paths = getReference( Paths.class ); IOService ioService = getReference( IOService.class ); ProjectService projectService = getReference( ProjectService.class ); URL url = this.getClass().getResource( "/GuvnorM2RepoDependencyExample1" ); SimpleFileSystemProvider p = new SimpleFileSystemProvider(); org.kie.commons.java.nio.file.Path path = p.getPath( url.toURI() ); final Builder builder = new Builder( path, "guvnor-m2repo-dependency-example1", paths, ioService, projectService ); final BuildResults results = builder.build(); assertTrue( results.getMessages().isEmpty() ); }
@Test public void testBuilderKProjectHasDependency() throws Exception { Paths paths = getReference( Paths.class ); IOService ioService = getReference( IOService.class ); ProjectService projectService = getReference( ProjectService.class ); URL url = this.getClass().getResource( "/GuvnorM2RepoDependencyExample2" ); SimpleFileSystemProvider p = new SimpleFileSystemProvider(); org.kie.commons.java.nio.file.Path path = p.getPath( url.toURI() ); final Builder builder = new Builder( path, "guvnor-m2repo-dependency-example2", paths, ioService, projectService ); final BuildResults results = builder.build(); assertTrue( results.getMessages().isEmpty() ); }
@Test public void testKProjectContainsXLS() throws Exception { Paths paths = getReference( Paths.class ); IOService ioService = getReference( IOService.class ); ProjectService projectService = getReference( ProjectService.class ); URL url = this.getClass().getResource( "/ExampleWithExcel" ); SimpleFileSystemProvider p = new SimpleFileSystemProvider(); org.kie.commons.java.nio.file.Path path = p.getPath( url.toURI() ); final Builder builder = new Builder( path, "example-with-excel", paths, ioService, projectService ); final BuildResults results = builder.build(); assertTrue( results.getMessages().isEmpty() ); }
if ( !results.getMessages().isEmpty() ) { buildResultsEvent.fire( results );
assertTrue( results.getMessages().isEmpty() );