use of org.apache.maven.plugin.MojoFailureException in project OpenAM by OpenRock.
the class CLIDefinitionGenerator method execute.
public void execute() throws MojoExecutionException, MojoFailureException {
for (String className : definitions) {
try {
Class clazz = Class.forName(className);
Field pdtField = clazz.getDeclaredField("product");
if (pdtField != null) {
DefinitionClassInfo classInfo = pdtField.getAnnotation(DefinitionClassInfo.class);
PrintStream rbOut = createResourcePrintStream(outputDir, classInfo);
getCommonResourceStrings(rbOut, clazz);
rbOut.println("product-name=" + classInfo.productName());
getCommands(className, clazz, rbOut);
rbOut.close();
} else {
throw new Exception("Incorrect Definiton, class=" + className + " missing product field");
}
} catch (Exception ex) {
throw new MojoFailureException("An error occured while generating CLI resources", ex);
}
}
Resource resource = new Resource();
resource.setDirectory(outputDir);
project.addResource(resource);
}
use of org.apache.maven.plugin.MojoFailureException in project OpenAM by OpenRock.
the class CLIDefinitionGenerator method validateOption.
private void validateOption(List<String> options) throws MojoFailureException {
for (String option : options) {
int idx = option.indexOf('|');
String longName = option.substring(0, idx);
String shortName = option.substring(idx + 1, idx + 2);
String test = mapLongToShortOptionName.get(longName);
if (test == null) {
mapLongToShortOptionName.put(longName, shortName);
} else if (!test.equals(shortName)) {
throw new MojoFailureException("Mismatched names: " + longName + "-> " + test + ", " + shortName);
}
}
}
use of org.apache.maven.plugin.MojoFailureException in project jangaroo-tools by CoreMedia.
the class JooTestMojo method execute.
public void execute() throws MojoExecutionException, MojoFailureException {
if (!skip && !skipTests && !skipJooUnitTests && isTestAvailable()) {
Server server = jettyRunTest(true);
String url = getTestUrl(server);
try {
File testResultOutputFile = new File(testResultOutputDirectory, getTestResultFileName());
File phantomTestRunner = new File(testResultOutputDirectory, "phantomjs-joounit-page-runner.js");
FileUtils.copyInputStreamToFile(getClass().getResourceAsStream("/net/jangaroo/jooc/mvnplugin/phantomjs-joounit-page-runner.js"), phantomTestRunner);
final PhantomJsTestRunner phantomJsTestRunner = new PhantomJsTestRunner(phantomBin, url, testResultOutputFile.getPath(), phantomTestRunner.getPath(), jooUnitTestExecutionTimeout, jooUnitMaxRetriesOnCrashes, getLog());
if (phantomJsTestRunner.canRun()) {
executePhantomJs(testResultOutputFile, phantomJsTestRunner);
} else {
executeSelenium(url);
}
} catch (IOException e) {
throw new MojoExecutionException("Cannot create local copy of phantomjs-joounit-page-runner.js", e);
} finally {
try {
server.stop();
} catch (Exception e) {
// never mind we just couldn't step the selenium server.
getLog().error("Could not stop test Jetty.", e);
}
}
}
}
use of org.apache.maven.plugin.MojoFailureException in project jangaroo-tools by CoreMedia.
the class JooTestMojoTest method testEvalTestOutputFailure.
public void testEvalTestOutputFailure() throws MojoExecutionException, MojoFailureException, IOException, SAXException, ParserConfigurationException {
String testResult = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" + "<testsuite errors=\"0\" failures=\"1\" name=\"com.coremedia.ui.data::BeanImplTest\" tests=\"21\" time=\"2814\"></testsuite>";
try {
jooTestMojo.evalTestOutput(new StringReader(testResult));
} catch (MojoFailureException e) {
return;
}
fail("Should reach that point (testing for exception)");
}
use of org.apache.maven.plugin.MojoFailureException in project aries by apache.
the class GenerateMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
List<String> toScan = getPackagesToScan();
if (!sourcesChanged()) {
getLog().info("Skipping blueprint generation because source files were not changed");
return;
}
BlueprintConfigurationImpl blueprintConfiguration = new BlueprintConfigurationImpl(namespaces, defaultActivation, customParameters);
try {
ClassFinder classFinder = createProjectScopeFinder();
Set<Class<?>> classes = FilteredClassFinder.findClasses(classFinder, toScan);
Blueprint blueprint = new Blueprint(blueprintConfiguration, classes);
writeBlueprintIfNeeded(blueprint);
} catch (Exception e) {
throw new MojoExecutionException("Error building commands help", e);
}
}
Aggregations