Source:
private void addPMMLPojos(PMMLCompiler compiler, Resource resource) { System.out.println("!!!!! PMMLCompiler version = "+compiler.getCompilerVersion()+" !!!!!"); KieFileSystem javaSource = KieServices.Factory.get().newKieFileSystem(); Map<String,String> javaSources = new HashMap<>(); Map<String,String> modelSources = null; try { modelSources = compiler.getJavaClasses(resource.getInputStream()); } catch (IOException e) { e.printStackTrace(); } if (modelSources != null && !modelSources.isEmpty()) { javaSources.putAll(modelSources); } for (String key: javaSources.keySet()) { String javaCode = javaSources.get(key); if (javaCode != null && !javaCode.trim().isEmpty()) { Resource res = ResourceFactory.newByteArrayResource(javaCode.getBytes()).setResourceType(ResourceType.JAVA); String sourcePath = key.replaceAll("\\.", "/")+".java"; res.setSourcePath(sourcePath); javaSource.write(res); } } ResourceReader src = ((KieFileSystemImpl)javaSource).asMemoryFileSystem(); List<String> javaFileNames = getJavaFileNames(src); if (javaFileNames != null && !javaFileNames.isEmpty()) { ClassLoader classLoader = rootClassLoader; KnowledgeBuilderConfigurationImpl kconf = new KnowledgeBuilderConfigurationImpl( classLoader ); JavaDialectConfiguration javaConf = (JavaDialectConfiguration) kconf.getDialectConfiguration( "java" ); MemoryFileSystem trgMfs = new MemoryFileSystem(); compileJavaClasses(javaConf, rootClassLoader, javaFileNames, JAVA_ROOT, src, trgMfs); Map<String, byte[]> classesMap = new HashMap<>(); for (String name: trgMfs.getFileNames()) { System.out.println(name); classesMap.put(name, trgMfs.getBytes(name)); } if (!classesMap.isEmpty()) { ((ProjectClassLoader)rootClassLoader).storeClasses(classesMap); } } }

Target:
private void addPMMLPojos(PMMLCompiler compiler, Resource resource) { KieFileSystem javaSource = KieServices.Factory.get().newKieFileSystem(); Map<String,String> javaSources = new HashMap<>(); Map<String,String> modelSources = null; try { modelSources = compiler.getJavaClasses(resource.getInputStream()); } catch (IOException e) { results.add(new SrcError(resource, e.getMessage())); } if (modelSources != null && !modelSources.isEmpty()) { javaSources.putAll(modelSources); } for (Map.Entry<String, String> entry: javaSources.entrySet()) { String key = entry.getKey(); String javaCode = entry.getValue(); if (javaCode != null && !javaCode.trim().isEmpty()) { Resource res = ResourceFactory.newByteArrayResource(javaCode.getBytes()).setResourceType(ResourceType.JAVA); String sourcePath = key.replaceAll("\\.", "/")+".java"; res.setSourcePath(sourcePath); javaSource.write(res); } } ResourceReader src = ((KieFileSystemImpl)javaSource).asMemoryFileSystem(); List<String> javaFileNames = getJavaFileNames(src); if (javaFileNames != null && !javaFileNames.isEmpty()) { ClassLoader classLoader = rootClassLoader; KnowledgeBuilderConfigurationImpl kconf = new KnowledgeBuilderConfigurationImpl( classLoader ); JavaDialectConfiguration javaConf = (JavaDialectConfiguration) kconf.getDialectConfiguration( "java" ); MemoryFileSystem trgMfs = new MemoryFileSystem(); compileJavaClasses(javaConf, rootClassLoader, javaFileNames, JAVA_ROOT, src, trgMfs); Map<String, byte[]> classesMap = new HashMap<>(); for (String name: trgMfs.getFileNames()) { classesMap.put(name, trgMfs.getBytes(name)); } if (!classesMap.isEmpty()) { ((ProjectClassLoader)rootClassLoader).storeClasses(classesMap); } } }