use of org.apache.maven.BuildFailureException in project scala-maven-plugin by davidB.
the class ScalaContinuousTestMojo method postCompileActions.
@Override
protected void postCompileActions() throws Exception {
if (test == null) {
getLog().info("Now running all the unit tests. Use -Dtest=FooTest to run a single test by name");
} else {
getLog().info("Now running tests matching: " + test);
}
final InvocationRequest request = new DefaultInvocationRequest();
request.setLocalRepositoryDirectory(localRepositoryPath);
request.setInteractive(false);
request.setErrorHandler(new SystemOutHandler(true));
request.setOutputHandler(new SystemOutHandler(true));
request.setBaseDirectory(project.getBasedir());
request.setPomFile(new File(project.getBasedir(), "pom.xml"));
request.setGoals(getMavenGoals());
request.setOffline(false);
if (test != null) {
Properties properties = new Properties();
properties.put("test", test);
request.setProperties(properties);
}
if (getLog().isDebugEnabled()) {
try {
getLog().debug("Executing: " + new MavenCommandLineBuilder().build(request));
} catch (CommandLineConfigurationException e) {
getLog().debug("Failed to display command line: " + e.getMessage());
}
}
try {
invoker.execute(request);
} catch (final MavenInvocationException e) {
getLog().debug("Error invoking Maven: " + e.getMessage(), e);
throw new BuildFailureException("Maven invocation failed. " + e.getMessage(), e);
}
}
Aggregations