The Ant task for Jasper JSP compiling (JspC) will fail (if failOnError = true) after a single error, without looking for other errors. This can be very challenging for large projects. For example, we have 2,487 JSPs that need compiling. If some part of the Java code is changed that breaks hundreds of JSPs (which, admittedly, means a developer didn't do his job correctly, but still), the continuous integration build for our project fails (as it should), but the log only shows one of the errors. The Ant task should have a new property, "failAfterAllErrors," that makes it log all compile failures as errors but continue compiling until every JSP compilation has been attempted. This is similar to how the javac Ant task works. It logs ALL of the compile errors, and only after having tried to compile everything, it fails the build. Thoughts? I am interested in possibly contributing code for this feature. I will email the developers' list later about it.
+1 to the idea, but I'd like to see an implementation that is more in line with similar tasks like <javac> and <junit>: they use "failOnError" (defaults to 'true' to get current behavior) and "errorProperty". If you set failOnError=false and errorProperty=jasperFailed, then you can test for jasperFailed and emit any kind of warning/error you'd like from your ant target.
Note: While I don't disagree with your suggestion, Chris, and we can certainly discuss it further, that's not how Ant's javac works. Javac failonerror defaults to true, and when it's set to true, the behavior is to try compiling everything and wait until all compile errors have happened before failing. In fact, as far as I can tell, there is actually no way to make it behave like JspC (fail after the first error). Relevant to 53011, 53012, 53031 and 53032: Per discussions with Chris Schultz in the users list, we agree that it would probably make more sense to separate the Ant task from the JspC class and place a new Ant task in the o.a.catalina.ant package (possibly o.a.catalina.ant.jasper?). Research about the state of the task needs to be completed. Further discussions about this will take place in the developer's list, and then these issues will be updated when a consensus is reached.
(In reply to comment #2) > Javac failonerror defaults to true, and when it's set to true, the behavior > is to try compiling everything and wait until all compile errors have > happened before failing. In fact, as far as I can tell, there is actually > no way to make it behave like JspC (fail after the first error). Fair enough. Perhaps a third setting to make it fail-fast (to emulate current behavior).
Created attachment 31555 [details] Patch to add an option "failFast" Appended is a patch that adds an option "failFast". Default is "false", so the build does not fail at the first compile error, but after the last JSP has been parsed using the following message: "Failed to compile JSPS: org.apache.jasper.JasperException: Aborted due to compilation failures!" Additionally, a tiny statistic will be printed. "JSP-compilations: 465, Errors: 20, Time elapsed: 60,777 sec"
(In reply to Marc Pompl from comment #4) > Patch to add an option "failFast" See corresponding issue for the maven-jspc-plugin https://github.com/Jasig/jspc-maven-plugin/issues/17
I have applied a variation of this patch (mainly to account for code changes) to 9.0.x and it will be included in 9.0.0.M22 onwards.