[#1114] Fix precompile-jsps profile for the Jakarta EE 9 webapp - #1120
Open
vharseko wants to merge 1 commit into
Open
[#1114] Fix precompile-jsps profile for the Jakarta EE 9 webapp#1120vharseko wants to merge 1 commit into
vharseko wants to merge 1 commit into
Conversation
…ta EE 9 webapp jetty-jspc-maven-plugin 9.4.0.M0 carries the Jetty 9 Jasper (Tomcat 8.5, javax.servlet), so it could not compile a single page of the migrated jakarta.servlet webapp. The build aborted on ssoadm.jsp, the first JSP in the list, and never reached the federation pages under saml2/jsp, wsfederation/jsp and config/federation. Move the plugin to 11.0.24, which matches the module's Servlet 5.0 / JSP 3.0 / JSTL 2.0 level, and configure the goal for validation only: - useProvidedScope=true. Both jakarta.servlet-api and jakarta.servlet.jsp-api resolve as provided, so without this the Servlet and JSP APIs are absent from the JspC classpath and every page fails regardless of the plugin version. - generatedClasses under target/jspc and mergeFragment=false, so neither a generated servlet nor a web.xml fragment can reach the war. Their defaults are target/classes and true, which would have changed the <jsp-file> servlet mappings. - sourceVersion/targetVersion taken from maven.compiler.*. - The exclude list narrowed to the two com_sun_web_ui/jsp/version pages that bind JATO view beans from openam-console, which is not on this module's classpath. The other files the old wildcards covered - WEB-INF/jsp/Version.jsp and the help/help2 Mastheads - compile fine, and userconsole.jsp does not exist in this module. 121 of the module's 123 JSPs now compile, in under 4 seconds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1114
The problem
jetty-jspc-maven-plugin:9.4.0.M0carries the Jetty 9 Jasper —org.mortbay.jasper:apache-jspbuilt on Tomcat 8.5, i.e.javax.servlet— while the webapp and every JSP in it have been migrated tojakarta.servlet. The generated source shows both worlds in one file:The build aborts on
ssoadm.jsp, which comes first, so nothing else is ever reached — the federation pages undersaml2/jsp/,wsfederation/jsp/andconfig/federation/were never compiled at all.There is a second, less visible blocker: the goal's
useProvidedScopedefaults tofalse, and this module resolves bothjakarta.servlet-api:5.0.0andjakarta.servlet.jsp-api:3.0.0inprovidedscope. Without that flag the Servlet and JSP APIs are simply absent from the JspC classpath, and every page fails no matter which plugin version is used.The fix
The module's level is Servlet 5.0 / JSP 3.0 / JSTL 2.0 — Jakarta EE 9 — so the matching plugin is
jetty-jspc-maven-plugin:11.0.24, which bringsjetty-jakarta-servlet-api:5.0.2,org.mortbay.jasper:apache-jsp:10.0.27and JSTL 2.0.0. Jetty 12 would be EE 10 and would diverge from the runtime.The goal is configured for validation only, not for shipping precompiled servlets:
useProvidedScope=truegeneratedClasses=target/jspctarget/classes, which would package generated servlets intoWEB-INF/classesmergeFragment=falsetrue; merging would rewrite the<jsp-file>servlet mappings (/SPSloInit/*and friends) — a behavioural change, not a checksourceVersion/targetVersionmaven.compiler.*(verified: major 55)The exclude list is narrowed from four wildcards to the two pages that genuinely cannot compile here:
com_sun_web_ui/jsp/version/ButtonFrame.jspandcom_sun_web_ui/jsp/version/Masthead.jsp, which bindcom.sun.identity.console.version.*ViewBeanfromopenam-console— not a dependency of this module. The old**/Masthead.jsppattern silenced three files to cover one;WEB-INF/jsp/Version.jspand thehelp/help2Mastheads compile fine, anduserconsole.jspdoes not exist in this module.ssoadm.jspcompiles too, so it needs no exclusion.Verification
BUILD SUCCESS; 121 of 123 JSPs compiled,Generation completed with [0] errors in [3896] milliseconds.find openam-server-only/target/classes -path "*org/apache/jsp*"→ 0 files; notarget/web.xmlis written. The war is unaffected.maven.compiler.target.SAML2Utils.thisMethodDoesNotExist(request)intosaml2/jsp/spSSOInit.jspfails the build withAn error occurred at line: [248] in the jsp file: [/saml2/jsp/spSSOInit.jsp], pointing at the JSP source rather than the generated Java. The profile now actually validates.Not covered here
webAppSourceDirectoryis this module'ssrc/main/webapp, so the 286 JSPs inopenam-consoleremain unvalidated. Adding the same profile there fails onUnable to find taglib [jato] for URI: [/WEB-INF/jato.tld]—jato.tldlives only inopenam-server-only/src/main/webapp/WEB-INF/, whileopenam-console/src/main/webapp/WEB-INF/holds justweb.xmlandtags. That needs its own change and is worth a separate issue.