Move source directory existence check earlier

This commit is contained in:
Sam Harwell 2012-12-01 13:52:25 -06:00
parent 924186ad46
commit 762fd6f320
1 changed files with 7 additions and 10 deletions

View File

@ -211,6 +211,11 @@ public class Antlr4Mojo extends AbstractMojo {
//
}
if (!sourceDirectory.exists()) {
log.info("No ANTLR 4 grammars to compile in " + sourceDirectory.getAbsolutePath());
return;
}
// Ensure that the output directory path is all in tact so that
// ANTLR can just write into it.
//
@ -245,17 +250,9 @@ public class Antlr4Mojo extends AbstractMojo {
// Set working directory for ANTLR to be the base source directory
tool.inputDirectory = sourceDirectory;
if (!sourceDirectory.exists()) {
if (log.isInfoEnabled()) {
log.info("No ANTLR 4 grammars to compile in " + sourceDirectory.getAbsolutePath());
}
return;
} else {
if (log.isInfoEnabled()) {
log.info("ANTLR 4: Processing source directory " + sourceDirectory.getAbsolutePath());
}
}
} catch (Exception e) {
log.error("The attempt to create the ANTLR 4 build tool failed, see exception report for details", e);
throw new MojoFailureException("Jim failed you!");