public String getVersion() { ByteArrayOutputStream buff = new ByteArrayOutputStream(); PrintStream out = new PrintStream(buff); CLIReportingUtils.showVersion(out); Closer.close(out); return new String(buff.toByteArray()); }
public Object execute(final CommandContext context) throws Exception { assert context != null; IO io = context.getIo(); java.util.prefs.Preferences prefs = node(); OutputStream out; if (file == null) { out = io.streams.out; } else { io.println("Exporting preferences to: {}", file); // TODO: i18n out = new BufferedOutputStream(new FileOutputStream(file)); } try { if (subTree) { prefs.exportSubtree(out); } else { prefs.exportNode(out); } Flusher.flush(out); } finally { if (file != null) { Closer.close(out); } } prefs.sync(); return Result.SUCCESS; }
public int execute(final MavenExecutionRequest request) throws Exception { assert request != null; if (log.isDebugEnabled()) { log.debug("Processing request: {}", Yarn.render(request, Yarn.Style.MULTI)); } configureRequest(request); try { return doExecute(request); } catch (Exception e) { CLIReportingUtils.showError( logger, "Error executing Maven.", e, request.isShowErrors()); // TODO: i81n return 1; } finally { container.dispose(); Closer.close(logStream); } }