John Patrick schrieb am 26.03.2022 16:12 (GMT +07:00):

> I thought maven.compiler.release only supports Java 9 and newer (The
> -release argument for the Java compiler, supported since Java9).

Small correction: The javac compiler option '--release N' exists since
JDK 9, but you can also compile to older versions. A little overview,
quickly compiled from what I happen to have installed locally (no 12):


javac | --release
------|----------
   9  | 6-9
  10  | 6-10
  11  | 6-11
  13  | 7-13
  14  | 7-14
  15  | 7-15
  16  | 7-16
  17  | 7-17
  18  | 7-18


BTW, most people around here probably know, but for those who do not:
'--release N' is **not** the same as '-source N -target N', but also
ensures that code is cross-compiled not just to the byte code level N
like with '-target N', but also to the exact JDK API of that version -
basically a more user-friendly way to set an older JDK as boot classpath
for compilation, without the need to install extra JDKs or toolchains.
Each JDK 9+ contains a compressed set of legacy API descriptions
utilised by '--release N'.

I.e., while the compiler option really just exists since JDK 9, you can
still target certain older bytecode and/or JDK API versions. And if you
need really old bytecode targets in a brandnew and well-maintained
compiler, you can use ECJ. Current version 3.29.0 still supports source
and target versions as old as 1.3 (and of course up to 18) - a unique
selling point in comparison to Javac.

-- 
Alexander Kriegisch
https://scrum-master.de

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to