in src/main/java/org/apache/sling/maven/jspc/JspcMojo.java [286:351]
public void execute() throws MojoExecutionException {
try {
uriSourceRoot = sourceDirectory.getCanonicalPath();
} catch (Exception e) {
uriSourceRoot = sourceDirectory.getAbsolutePath();
}
// ensure output directory
File outputDirectoryFile = new File(outputDirectory);
if (!outputDirectoryFile.isDirectory()) {
if (outputDirectoryFile.exists()) {
throw new MojoExecutionException(outputDirectory
+ " exists but is not a directory");
}
if (!outputDirectoryFile.mkdirs()) {
throw new MojoExecutionException(
"Cannot create output directory " + outputDirectory);
}
}
// have the files compiled
String previousJasperPackageName = null;
String oldValue = System.getProperty(LogFactoryImpl.LOG_PROPERTY);
try {
// ensure the JSP Compiler does not try to use Log4J
System.setProperty(LogFactoryImpl.LOG_PROPERTY, SimpleLog.class.getName());
previousJasperPackageName =
System.setProperty(Constants.JSP_PACKAGE_NAME_PROPERTY_NAME, (servletPackage != null ? servletPackage : ""));
executeInternal();
if (dependencyTracker != null) {
if (printCompilationReport) {
printCompilationReport(dependencyTracker);
}
if (generateCompilationReport) {
generateCompilationReport(dependencyTracker);
}
}
} catch (JasperException je) {
getLog().error("Compilation Failure", je);
throw new MojoExecutionException(je.getMessage(), je);
} finally {
if (oldValue == null) {
System.clearProperty(LogFactoryImpl.LOG_PROPERTY);
} else {
System.setProperty(LogFactoryImpl.LOG_PROPERTY, oldValue);
}
if (previousJasperPackageName == null) {
System.clearProperty(Constants.JSP_PACKAGE_NAME_PROPERTY_NAME);
} else {
System.setProperty(Constants.JSP_PACKAGE_NAME_PROPERTY_NAME, previousJasperPackageName);
}
if (featureSupport != null) {
try {
featureSupport.shutdown(10000);
} catch (Exception e) {
getLog().error(e);
}
featureSupport = null;
}
}
project.addCompileSourceRoot(outputDirectory);
}