Refine search
public int run(List<String> command, List<String> output) { int retCode = 1; ProcessBuilder pb = new ProcessBuilder(command); try { Process p = pb.start(); OutputBufferThread stdOut = new OutputBufferThread(p.getInputStream()); OutputBufferThread stdErr = new OutputBufferThread(p.getErrorStream()); stdOut.start(); stdErr.start(); retCode = p.waitFor(); if (retCode != 0) { mojo.getLog().warn(command + " failed with error code " + retCode); for (String s : stdErr.getOutput()) { mojo.getLog().debug(s); } } stdOut.join(); stdErr.join(); output.addAll(stdOut.getOutput()); } catch (Exception ex) { mojo.getLog().warn(command + " failed: " + ex.toString()); } return retCode; }
mojo.execute();
( (Mojo) mojo ).setLog( new DefaultLog( mojoLogger ) );
/** * Executes the mojo * * @throws MojoExecutionException * @throws MojoFailureException */ public void execute() throws MojoExecutionException, MojoFailureException { mojo.getLog().info("Instrumenting classes located in " + location); String extraClasspath = createClassPathString(); mojo.getLog().debug("Using classpath " + extraClasspath); try { InstrumentationRunner.runInstrumentation(// createConfigurer(), new Directory(location), extraClasspath); } catch (Exception e) { mojo.getLog().error(e.getMessage()); throw new MojoExecutionException("Unexpected error", e); } mojo.getLog().info("Classes instrumented sucessfully"); }
mojo.getLog().debug("Creating error file for '" + e.getMessage() + "' happening at " + e.getLine() + ":" + e .getCharacter() + " of " + e.getFile() + ", created by watcher : " + watcher); JSONObject obj = new JSONObject(); FileUtils.writeStringToFile(getErrorFileForWatcher(watcher), obj.toJSONString(), false); } catch (IOException e1) { mojo.getLog().error("Cannot write the error file", e1);
@Override public boolean isInfoEnabled() { return mojo.getLog().isInfoEnabled(); }
@Override public boolean isDebugEnabled() { return mojo.getLog().isDebugEnabled(); }
@Override public boolean isWarnEnabled() { return mojo.getLog().isWarnEnabled(); }
@Override public boolean isErrorEnabled() { return mojo.getLog().isErrorEnabled(); }
private org.apache.maven.plugin.logging.Log getLog() { if (mojo == null) { throw new RuntimeException("Mojo not set; can not delegate logging"); } return mojo.getLog(); }
mojo.getLog().info(EMPTY_STRING); mojo.getLog().info("The watcher has detected a change in " + file.getAbsolutePath()); mojo.getLog().info(EMPTY_STRING); for (Watcher watcher : watchers) { if (watcher.accept(file)) { continueProcessing = watcher.fileUpdated(file); } catch (WatchingException e) { //NOSONAR mojo.getLog().debug(watcher + " has thrown an exception while handling the " + file.getName() + EMPTY_STRING + " update", e); mojo.getLog().error(String.format(WATCHING_EXCEPTION_MESSAGE, e.getMessage())); createErrorFile(watcher, e); continueProcessing = false; mojo.getLog().info(EMPTY_STRING); mojo.getLog().info(EMPTY_STRING);
@Override public boolean isInfoEnabled() { return mojo.getLog().isInfoEnabled(); }