private void compile() throws WatchingException { try { execute(); } catch (MojoExecutionException e) { if (e.getCause() != null && e.getCause().getClass().getName().equals("org.apache.maven.plugin.compiler" + ".CompilationFailureException")) { throw CompilerExecutor.build(this, e.getCause()); } throw new WatchingException("Compilation error", e); } }
private void compile() throws WatchingException { try { execute(); } catch (MojoExecutionException e) { if (e.getCause() != null && e.getCause().getClass().getName().equals("org.apache.maven.plugin.compiler" + ".CompilationFailureException")) { throw CompilerExecutor.build(this, e.getCause()); } throw new WatchingException("Compilation error", e); } }
private WatchingException buildWatchingException(String stream, File file, MojoExecutionException e) { String[] lines = stream.split("\n"); for (String l : lines) { if (!Strings.isNullOrEmpty(l)) { stream = l.trim(); break; } } final Matcher matcher = LESS_ERROR_PATTERN.matcher(stream); if (matcher.matches()) { String line = matcher.group(2); String character = matcher.group(3); String reason = matcher.group(1); return new WatchingException("Less Compilation Error", reason, file, Integer.valueOf(line), Integer.valueOf(character), null); } else { return new WatchingException("Less Compilation Error", stream, file, e.getCause()); } }
); } catch (MojoExecutionException e) { if (e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof ArtifactNotFoundException) { ArtifactNotFoundException artifactNotFoundException = (ArtifactNotFoundException) e.getCause().getCause(); throw artifactNotFoundException; } else if (e.getCause() != null && e.getCause().getCause() != null && e.getCause().getCause() instanceof ArtifactResolutionException) { ArtifactResolutionException artifactResolutionException = (ArtifactResolutionException) e.getCause().getCause(); throw artifactResolutionException;