use of org.kie.workbench.common.services.backend.compiler.impl.PomPlaceHolder in project kie-wb-common by kiegroup.
the class DefaultIncrementalCompilerEnabler method process.
@Override
public ProcessedPoms process(final CompilationRequest req) {
Path mainPom = Paths.get(req.getInfo().getPrjPath().toString(), POM_NAME);
if (!Files.isReadable(mainPom)) {
return new ProcessedPoms(Boolean.FALSE, Collections.emptyList());
}
PomPlaceHolder placeHolder = editor.readSingle(mainPom);
// check if the main pom is already scanned and edited
Boolean isPresent = isPresent(placeHolder);
if (placeHolder.isValid() && !isPresent) {
List<String> pomsList = new ArrayList<>();
MavenUtils.searchPoms(Paths.get(req.getInfo().getPrjPath().toString()), // recursive NIO search in all subfolders
pomsList);
if (pomsList.size() > 0) {
processFoundPoms(pomsList, req);
}
return new ProcessedPoms(Boolean.TRUE, pomsList);
} else {
return new ProcessedPoms(Boolean.FALSE, Collections.emptyList());
}
}
use of org.kie.workbench.common.services.backend.compiler.impl.PomPlaceHolder in project kie-wb-common by kiegroup.
the class DefaultIncrementalCompilerEnabler method processFoundPoms.
private void processFoundPoms(List<String> poms, CompilationRequest request) {
for (String pom : poms) {
Path tmpPom = Paths.get(pom);
PomPlaceHolder tmpPlaceHolder = editor.readSingle(tmpPom);
if (!isPresent(tmpPlaceHolder)) {
editor.write(tmpPom, request);
}
}
Path mainPom = Paths.get(request.getInfo().getPrjPath().toAbsolutePath().toString(), POM_NAME);
request.getInfo().lateAdditionEnhancedMainPomFile(mainPom);
}
Aggregations