We need to create
- Command to execute Jar file
- execute the command
---------------------------------------------------------------------------------
private void analyze() {
try {
String workdirRoot = fileSystem.workDir().getCanonicalPath();
extractor.extractPlsql(workdirRoot);
String baseDir = fileSystem.baseDir().getCanonicalPath();
String srcDirectory = context.config().get(SONAR_SOURCES).orElseThrow(RuntimeException::new);
String configDirectory = context.config().get(SONAR_CONFIG).orElseThrow(RuntimeException::new);
LOG.info("workdirRoot="+workdirRoot);
LOG.info("baseDir="+baseDir);
LOG.info("srcDirectory="+srcDirectory);
LOG.info("configDirectory="+configDirectory);
LOG.info("executablePatj="+workdirRoot + File.separator + EXECUTABLE);
LOG.info("srcDirPath="+baseDir + File.separator + srcDirectory);
LOG.info("InitFile="+workdirRoot + File.separator + FooSQL_INIT_PROPERTY_FILE);
LOG.info("violationReport="+workdirRoot + File.separator + VIOLATION_REPORT_NAME);
LOG.info("astFolder="+configDirectory + File.separator + AST_FOLDER);
Command command = Command.create("java");
command.addArgument("-jar")
.addArgument(workdirRoot + File.separator + EXECUTABLE)
// .addArgument(baseDir + File.separator + srcDirectory)
.addArgument(baseDir)
.addArgument(workdirRoot + File.separator + FooSQL_INIT_PROPERTY_FILE)
.addArgument(workdirRoot + File.separator + VIOLATION_REPORT_NAME)
.addArgument(configDirectory + File.separator + AST_FOLDER)
.addArgument(workdirRoot)
.addArgument(configDirectory);
LOG.info(command.toCommandLine());
CommandExecutor.create().execute(command, LOG::info, LOG::error, Integer.MAX_VALUE);
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
No comments:
Post a Comment