-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not stop on first JSP containing a compile error #17
Comments
Here is the code snippet which replaces the while-loop in class JspC. In order to use the patch without patching the Jasper-Compiler you have to clone the class JspC into your project jspc-compiler-tomcatN. long time=System.currentTimeMillis();
int errors = 0;
while (iter.hasNext()) {
String nextjsp = iter.next().toString();
File fjsp = new File(nextjsp);
if (!fjsp.isAbsolute()) {
fjsp = new File(uriRootF, nextjsp);
}
if (!fjsp.exists()) {
if (log.isWarnEnabled()) {
log.warn
(Localizer.getMessage
("jspc.error.fileDoesNotExist", fjsp.toString()));
}
continue;
}
String s = fjsp.getAbsolutePath();
if (s.startsWith(uriRoot)) {
nextjsp = s.substring(uriRoot.length());
}
if (nextjsp.startsWith("." + File.separatorChar)) {
nextjsp = nextjsp.substring(2);
}
try {
processFile(nextjsp);
}
catch(JasperException ex) {
errors++;
log.error(nextjsp + ":" + ex.getMessage());
}
}
String timeFromatted = new DecimalFormat("#.###").format((double)(System.currentTimeMillis()-time)/1000);
System.out.println("JSP-compilations: "+pages.size()+", Errors: "+errors+", Time elapsed: "+timeFromatted+" sec");
if (errors > 0) {
throw new JasperException("Aborted due to compilation failures!");
} Edit: Added syntax highlighting to java snippet |
Hey there! 👋 Thanks for opening an issue with jspc-maven-plugin. 👍 🙇♂️ Thanks again for contributing to the jspc-maven-plugin! ✨ |
It would be really helpful, if the compiler would not stop on the first JSP with compile errors, but continue until the last has been compiled---within the same maven module, of course.
If some users prefer the old way (stop on first compile error), an option like "jspc.failFast" should be introduced.
Additionally, a line showing some statistics would be really nice, like
total: 127 (JSP files) errors: 42 (JSP files)
Also see https://issues.apache.org/bugzilla/show_bug.cgi?id=53011
The text was updated successfully, but these errors were encountered: