Skip to content
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

Open
Lynorics opened this issue Apr 22, 2014 · 3 comments
Open

Do not stop on first JSP containing a compile error #17

Lynorics opened this issue Apr 22, 2014 · 3 comments

Comments

@Lynorics
Copy link

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

@Lynorics
Copy link
Author

Lynorics commented Apr 23, 2014

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

@ChristianMurphy
Copy link
Member

@akram @Lynorics would either of you be interested in updating #19 so this feature could be merged in?

@ChristianMurphy
Copy link
Member

Hey there! 👋

Thanks for opening an issue with jspc-maven-plugin. 👍 🙇‍♂️
At the moment, the jspc maven plugin does not have an active maintainer to process your request. ⛔
While the Jasig jspc maven plugin is without an active maintainer, we recommend the Apache Sling jspc maven plugin and the Jetty jspc maven plugin as alternatives that are actively maintained. ✅
If you are interested in becoming a project maintainer, there is a uPortal-dev list post where you can register your interest. 📧

Thanks again for contributing to the jspc-maven-plugin! ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants