private void savePOM(final Path pomPath, final POM pom, final Metadata metadata) throws IOException, XmlPullParserException { final Optional<Module> oldModuleForUpdateEvent = getModuleIfPomHasChanges(pomPath, pom); if (metadata == null) { ioService.write(Paths.convert(pomPath), pomContentHandler.toString(pom, loadPomXMLString(pomPath))); } else { ioService.write(Paths.convert(pomPath), pomContentHandler.toString(pom, loadPomXMLString(pomPath)), metadataService.setUpAttributes(pomPath, metadata)); } if (oldModuleForUpdateEvent.isPresent()) { updates.add(() -> moduleUpdatedEvent.fire(new ModuleUpdatedEvent(oldModuleForUpdateEvent.get(), moduleService.resolveModule(pomPath)))); } }
private void savePOM(final Path pomPath, final POM pom, final Metadata metadata) throws IOException, XmlPullParserException { final Optional<Module> oldModuleForUpdateEvent = getModuleIfPomHasChanges(pomPath, pom); if (metadata == null) { ioService.write(Paths.convert(pomPath), pomContentHandler.toString(pom, loadPomXMLString(pomPath))); } else { ioService.write(Paths.convert(pomPath), pomContentHandler.toString(pom, loadPomXMLString(pomPath)), metadataService.setUpAttributes(pomPath, metadata)); } if (oldModuleForUpdateEvent.isPresent()) { updates.add(() -> moduleUpdatedEvent.fire(new ModuleUpdatedEvent(oldModuleForUpdateEvent.get(), moduleService.resolveModule(pomPath)))); } }
public Path savePOM(final boolean updateModules) { try { ioService.startBatch(Paths.convert(pomPath).getFileSystem(), optionsFactory.makeCommentedOption(comment != null ? comment : "")); savePOM(); if (updateModules) { saveSubModulePOMs(); } return pomPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } finally { ioService.endBatch(); for (final Command update : updates) { update.execute(); } } }
private void saveGAVChange(final GAV gav, final String childModuleName) throws IOException, XmlPullParserException { final org.uberfire.java.nio.file.Path childPOMPath = Paths.convert(pomPath).getParent().resolve(childModuleName).resolve("pom.xml"); if (ioService.exists(childPOMPath)) { final POM childContent = load(Paths.convert(childPOMPath)); if (childContent != null) { childContent.setParent(gav); childContent.getGav().setGroupId(gav.getGroupId()); childContent.getGav().setVersion(gav.getVersion()); savePOM(Paths.convert(childPOMPath), childContent, null); } } } }
private void saveGAVChange(final GAV gav, final String childModuleName) throws IOException, XmlPullParserException { final org.uberfire.java.nio.file.Path childPOMPath = Paths.convert(pomPath).getParent().resolve(childModuleName).resolve("pom.xml"); if (ioService.exists(childPOMPath)) { final POM childContent = load(Paths.convert(childPOMPath)); if (childContent != null) { childContent.setParent(gav); childContent.getGav().setGroupId(gav.getGroupId()); childContent.getGav().setVersion(gav.getVersion()); savePOM(Paths.convert(childPOMPath), childContent, null); } } } }
public Path savePOM(final boolean updateModules) { try { ioService.startBatch(Paths.convert(pomPath).getFileSystem(), optionsFactory.makeCommentedOption(comment != null ? comment : "")); savePOM(); if (updateModules) { saveSubModulePOMs(); } return pomPath; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } finally { ioService.endBatch(); for (final Command update : updates) { update.execute(); } } }
private void savePOM() throws IOException, XmlPullParserException { savePOM(pomPath, pom, metadata); }
private void saveSubModulePOMs() throws IOException, XmlPullParserException { if (pom.isMultiModule() && pom.getModules() != null) { for (final String childModuleName : pom.getModules()) { saveGAVChange(pom.getGav(), childModuleName); } } }
private void savePOM() throws IOException, XmlPullParserException { savePOM(pomPath, pom, metadata); }
private void saveSubModulePOMs() throws IOException, XmlPullParserException { if (pom.isMultiModule() && pom.getModules() != null) { for (final String childModuleName : pom.getModules()) { saveGAVChange(pom.getGav(), childModuleName); } } }