Skip to content

Spring Boot 2.1.0 M2 and JSP "error source level" #14398

@Maze-fr

Description

@Maze-fr

Hello,

I am currently upgrading from using Spring Platform Athens-SR6 to Spring Boot Starter Parent 2.1.0 M2 (preparing for Java 11).
I finished upgrading changing class names, libs, etc. and I proudly start my test application, and then...

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [23] in the generated java file: [... not interesting path to the Java file generated for the JSP ...]
Syntax error, parameterized types are only available if source level is 1.5 or greater

An error occurred at line: [38] in the generated java file: [... not interesting path to the Java file generated for the JSP ...]
'<>' operator is not allowed for source level below 1.7

[... and many others ...]

I spent about a day to find the solution, after checking and changing Eclipse (Photon, in my case) compiler compliance level, trying to force compilerSourceVM property, loosing my sanity in StackOverflow, etc.
The solution is to force a dependency on org.eclipse.jdt.core.compiler:ecj with 4.6.1 version. I tried manually with 4.3.1 (see below), and I tried org.eclipse.jdt:ecj (see below) with version 3.14.0, but both didn't work.

I decided to compare my dependency hierarchies between the 2 configurations :

  • Spring Platform Athens-SR6 :
    • tomcat-embed-jasper 8.5.15 gives me org.eclipse.jdt:ecj 3.12.3 ; in a Tomcat 8.5.15 installation zip, there is org.eclipse.jdt.core.compiler:ecj 4.6.3 version lib, from org.eclipse.jdt:ecj 3.12.3 bundle
    • spring-boot-dependencies:1.4.7.RELEASE gives me querydsl-collections:4.1.4 that gives me org.eclipse.jdt.core.compiler:ecj 4.3.1
  • Spring Boot Starter Parent 2.1.0 M2 :
    • tomcat-embed-jasper 9.0.10 gives me org.eclipse.jdt:ecj 3.13.102 ; in a Tomcat 9.0.11 installation, there is org.eclipse.jdt.core.compiler:ecj 4.7.3a version lib, from org.eclipse.jdt:ecj 3.13.102 bundle
    • spring-boot-dependencies:2.1.0.M2 gives me querydsl-collections 4.2.1 gives me org.eclipse.jdt.core.compiler:ecj 4.3.1

So... nothing special...
According to that, the final solution I use, which seems cleaner to me, is to exclude org.eclipse.jdt.core.compiler:ecj 4.3.1 from querydsl-collections 4.2.1 so that I use effectively org.eclipse.jdt:ecj 3.13.102.

It brings me to ask 2 questions :

  • Considering that Spring Boot 2.1 is supposed not to support Java version under 1.8, shouldn't it be relevant to force JSP source compilation level to a minimum of Java 1.8 if it isn't explicitly specified ?
  • It really bothers me to have to force the "good" ecj version as I think it should be provided by spring-boot-something-starter dependency. Isn't there a conflict on ecj lib versions that has to be solved in ?

Regards ;-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions