// compile generated entities
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
Collection<File> generatedFiles = FileUtils.listFiles(new File(generatedDirPath + File.separator + "com"),
new RegexFileFilter("^.*\\.java$"), null);
Iterable generatedFilesIterable = fileManager.getJavaFileObjectsFromFiles(generatedFiles);
String[] options = new String[] {"-d", generatedBinDirPath};
boolean compileSuccess = compiler.getTask(null, null, null, Arrays.asList(options),
null, generatedFilesIterable).call();
fileManager.close();