Re: question java 1.7 support

2022-03-26 Thread John Patrick
Most people and use cases have the Java Home is the same version you put in
source/target/release.

The part I was trying to highlight was, if you set release and have Java
Home and Path to Java 1.7 (as the title of the email indicates), then it
won't work, so you need to use source and target.
If it was a type and the person has Java Home and Path set to Java 17, then
use release.

Also what I posted is the text from the maven compiler plugin.


On Sat, 26 Mar 2022 at 15:05, Alexander Kriegisch 
wrote:

> 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
>
>


Re: question java 1.7 support

2022-03-26 Thread Alexander Kriegisch
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



Re: question java 1.7 support

2022-03-26 Thread John Patrick
Alexander,
Your email says Java 1.7, your sdkman says 17 and your maven pom says 1.17.

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

If you are wanting Java 1.7 (released July 2011) then use user properties;
1.7
1.7
also;
delete user property maven.compiler.release
from maven-compiler-plugin configuration, delete source and target.


If you want Java 17 (released September 2021), then use user property;
17
also;
delete user property maven.compiler.source
delete user property maven.compiler.target
from maven-compiler-plugin configuration, delete source and target.

John


On Sat, 26 Mar 2022 at 04:11, Olivier Lamy  wrote:

> On Sat, 26 Mar 2022 at 2:06 pm, Nils Breunese  wrote:
>
> > Olivier Lamy  wrote:
> >
> > > should be 1.7 not 1.17 ;)
> >
> > No, 1.7 is for Java 7. For Java 17 it should be just 17.
>
>
> The email subject says “ question java 1.7 support”
> But yeah should be simply 17
> Use release flag rather than sources and target
>
> >
> >
> > Nils.
> >
> > > On Sat, 26 Mar 2022 at 13:48, Alexander Ushakov <
> > > alexander.ushakov.em...@gmail.com> wrote:
> > >
> > >> Hello!
> > >>
> > >> I am trying to play with Apache Kafka and craft next pom.xml
> > >>
> > >> ```xml
> > >>
> > >>  > >> xmlns="http://maven.apache.org/POM/4.0.0;
> > >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
> > >> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > >> http://maven.apache.org/xsd/maven-4.0.0.xsd;>
> > >>   4.0.0
> > >>   streams.examples
> > >>   streams.examples
> > >>   0.1
> > >>   jar
> > >>   Kafka Streams Demo Application
> > >>   
> > >>
> UTF-8
> > >>  3.1.0
> > >>  1.7.7
> > >>  1.2.17
> > >>  1.17
> > >>   
> > >>   
> > >>  
> > >> apache.snapshots
> > >> Apache Development Snapshot Repository
> > >> 
> > >> https://repository.apache.org/content/repositories/snapshots/
> > >> 
> > >>false
> > >> 
> > >> 
> > >>true
> > >> 
> > >>  
> > >>   
> > >>   
> > >>  
> > >> 
> > >>org.apache.maven.plugins
> > >>maven-compiler-plugin
> > >>3.1
> > >>
> > >>   1.17
> > >>   1.17
> > >>
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >> 
> > >>  
> > >>   
> > >>   
> > >>  
> > >> org.apache.kafka
> > >> kafka-streams
> > >> ${kafka.version}
> > >>  
> > >>  
> > >> org.slf4j
> > >> slf4j-api
> > >> ${slf4j.version}
> > >>  
> > >>  
> > >> org.slf4j
> > >> slf4j-simple
> > >> ${slf4j.version}
> > >>  
> > >>   
> > >>
> > >> ```
> > >>
> > >> command
> > >>
> > >> ```sh
> > >> mvn clean package
> > >> ```
> > >>
> > >> results with error
> > >>
> > >> ```
> > >> [ERROR] Failed to execute goal
> > >> org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
> > >> (default-compile) on project streams.examples: Fatal error compiling:
> > >> error: invalid target release: 1.17 -> [Help 1]
> > >> ```
> > >>
> > >> Java and Maven has been installed through SdkMan. Java 17.
> > >>
> > >> Can someone, please, suggest the solution?
> > >>
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
> >
>