Skip to content

Goal 'compile-jsp' uses wrong source/target #1812

@bmarwell

Description

@bmarwell

Hi,

when migrating to 11/17, we caught an error in the CompileJspMojo logic:

Potential issues

it tries to read "source" from the maven war plugin. However:

  • Source Level and Target level are two different things - I do not see a target level specified
  • maven.compiler.release seems ignored which is the better option, if set.
  • It completely ignores the server.xml properties which are both valid:
    <jspEngine javaSourceLevel="21" /> or <jspEngine jdkSourceLevel="18" />

While both work, the current docs only mention "javaSourceLevel" to avoid confusion: jdkSourceLevel uses "18" for "1.8" or simply "8" and does not go beyond that.

Recommended changes

  1. use server.xml (location: configurable) when present.
    a. prefer javaSourceLevel
    b. then the next best option is jdkSourceLevel
  2. Otherwise use pom.xml settings
    a. Prefer "release" paramter of Maven compiler Plugin
    b. Otherwise use source (as of now)

Other changes

Breaking changes

  • Potentially fixes builds :) Previously, you could not really set the target properly.
  • source should have been target all along, as far as I can tell

Other things to be aware of

I found that jsp-level (2.2/2.3) could have been read from server.xml as well. You might want to open another ticket for this.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions