class DefaultPomEditor implements PomEditor {

    public boolean write(Path pom,
                         CompilationRequest request) {

        try {
            Model model = reader.read(new ByteArrayInputStream(Files.readAllBytes(pom)));
            if (model == null) {
                logger.error("Model null from pom file:",
                             pom.toString());
                return false;
            }

            PomPlaceHolder pomPH = new PomPlaceHolder(pom.toAbsolutePath().toString(),
                                                      model.getArtifactId(),
                                                      model.getGroupId(),
                                                      model.getVersion(),
                                                      model.getPackaging(),
                                                      Files.readAllBytes(pom));

            if (!history.contains(pomPH)) {

                PluginPresents plugs = updatePom(model);
                request.getInfo().lateAdditionKiePluginPresent(plugs.isKiePluginPresent());
                if (!request.skipProjectDependenciesCreationList()) {
                    // we add the mvn cli args to run the dependency:build-classpath
                    String args[] = addCreateClasspathMavenArgs(request.getKieCliRequest().getArgs(), request);
                    request.getKieCliRequest().setArgs(args);
                }
                if (plugs.pomOverwriteRequired()) {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    writer.write(baos,
                                 model);
                    if (logger.isDebugEnabled()) {
                        logger.debug("Pom changed:{}",
                                     new String(baos.toByteArray(),
                                                StandardCharsets.UTF_8));
                    }

                    Path pomParent = Paths.get(URI.create(
                            new StringBuffer().
                                    append(FILE_URI).
                                    append(pom.getParent().toAbsolutePath().toString()).
                                    append("/").
                                    append(POM_NAME).toString()));
                    Files.delete(pomParent);
                    Files.write(pomParent,
                                baos.toByteArray(),
                                StandardOpenOption.CREATE_NEW);//enhanced pom
                }
                history.add(pomPH);
            }
            return true;
        } catch (Exception e) {
            logger.error(e.getMessage());
            return false;
        }
    }

    public  DefaultPomEditor(Set<PomPlaceHolder> history,
                            ConfigurationProvider config);

}