Fatal error compiling: error: release version 17 not supported

parax

Mitglied
Ich verwende das ubi8/openjdk-17-runtime-Image, um Maven-Tasks in Jenkins auszuführen.
mvn -version
Apache Maven 3.9.0
Java version: 17.0.4

java -version
openjdk version "17.0.4" 2022-07-19 LTS
Aus irgendeinem Grund erhalte ich beim Kompilieren des Codes die folgende Fehlermeldung:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile: Fatal error compiling: error: Fatal error compiling: error: release version 17 not supported
pom.xml
<properties>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
<source.version>${java.version}</source.version>

<boat-maven-plugin.version>0.16.1</boat-maven-plugin.version>
<build-helper-maven-plugin.version>3.3.0</build-helper-maven-plugin.version>
<docker-maven-plugin.version>0.40.2</docker-maven-plugin.version>
<dockerfile-maven-plugin.version>1.4.13</dockerfile-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
<jgitflow-maven-plugin.version>1.0-m5.1</jgitflow-maven-plugin.version>
<flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-dependency-plugin.version>3.3.0</maven-dependency-plugin.version>
<maven-deploy-plugin.version>3.0.0</maven-deploy-plugin.version>
<maven-enforcer-plugin.version>3.1.0</maven-enforcer-plugin.version>
<maven-failsafe-plugin.version>3.0.0-M7</maven-failsafe-plugin.version>
<maven-install-plugin.version>3.0.1</maven-install-plugin.version>
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
<maven-release-plugin.version>3.0.0-M6</maven-release-plugin.version>
<maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
<maven-shade-plugin.version>3.3.0</maven-shade-plugin.version>
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
<maven-site-plugin.version>4.0.0-M3</maven-site-plugin.version>
<openapi-generator-maven-plugin.version>5.4.0</openapi-generator-maven-plugin.version>
<spring-boot-maven-plugin.version>2.6.8</spring-boot-maven-plugin.version>
<sonar-maven-plugin.version>3.9.1.2184</sonar-maven-plugin.version>
<versions-maven-plugin.version>2.11.0</versions-maven-plugin.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Ich habe bereits versucht, JAVA_HOME auf diese Weise zu erzwingen:
withEnv(["JAVA_HOME=/usr/lib/jvm/java-17-openjdk-17.0.4.0.8-2.el8_6.x86_64"])
Aber das Ergebnis änderte sich nicht.

Hier die Ausgabe von mvn clean verify:
+ mvn -V clean verify -Dcheckstyle.skip=true
Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /opt/maven
Java version: 17.0.4, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.4.0.8-2.el8_6.x86_64
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.10.0-1160.81.1.el7.x86_64", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
.
.
.
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.873 s
[INFO] Finished at: 2023-03-24T19:20:31+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project async-support: Fatal error compiling: error: release version 17 not supported -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :async-support
Ich habe kürzlich die Java-Version aktualisiert, daher liegt das Problem höchstwahrscheinlich eher in der Maven/Java-Konfiguration als im Code.
 

parax

Mitglied
mvn -X -V clean verify -Dcheckstyle.skip=true
Apache Maven 3.9.0 (9b58d2bad23a66be161c4664ef21ce219c2c8584)
Maven home: /opt/maven
Java version: 17.0.4, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.4.0.8-2.el8_6.x86_64
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.10.0-1160.81.1.el7.x86_64", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
.
.
.

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.854 s
[INFO] Finished at: 2023-03-26T15:12:11+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project async-support: Fatal error compiling: error: release version 17 not supported -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project async-support: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:347)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1220)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.codehaus.plexus.compiler.CompilerException: error: release version 17 not supported
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:197)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:182)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1209)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.IllegalArgumentException: error: release version 17 not supported
at com.sun.tools.javac.main.Arguments.reportDiag (Arguments.java:889)
at com.sun.tools.javac.main.Arguments.handleReleaseOptions (Arguments.java:311)
at com.sun.tools.javac.main.Arguments.processArgs (Arguments.java:350)
at com.sun.tools.javac.main.Arguments.init (Arguments.java:246)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:191)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:119)
at com.sun.tools.javac.api.JavacTool.getTask (JavacTool.java:68)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:135)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:182)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1209)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :async-support
[DEBUG] Shutting down adapter factory; available factories [file-lock, rwlock-local, semaphore-local, noop]; available name mappers [discriminating, file-gav, file-hgav, gav, static]
[DEBUG] Shutting down 'file-lock' factory
[DEBUG] Shutting down 'rwlock-local' factory
[DEBUG] Shutting down 'semaphore-local' factory
[DEBUG] Shutting down 'noop' factory
 

parax

Mitglied
Leider kann ich den Rest nicht teilen und ich glaube auch, dass das Problem nicht im Plugin liegt, da mir gesagt wurde, dass derselbe Befehl in anderen Umgebungen funktioniert (aber es nicht beweisen kann).
 

mrBrown

Super-Moderator
Mitarbeiter
Was geben im selben Container javac -version und echo $JAVA_HOME aus?

Ansonsten: runterbrechen auf das minimalste Beispiel, mit dem der Fehler noch auftritt. Alles an Code raus, alles an Plugins raus, ...
 

mihe7

Top Contributor
Ich denke auch, dass hier einfach eine falsche Version des Java-Compilers ausgeführt wird:
Code:
Caused by: java.lang.IllegalArgumentException: error: release version 17 not supported
   at com.sun.tools.javac.main.Arguments.reportDiag (Arguments.java:889)
 
G

Gelöschtes Mitglied 76266

Gast
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile: Fatal error compiling: error: Fatal error compiling: error: release version 17 not supported
The error message is clear enough. Version 17 does NOT support maven-compiler-plugin:3.10.1.
 
G

Gelöschtes Mitglied 76266

Gast
Misleading or not, software packages should be synchronized with each other. That is the problem of most developers who use IDE to develop app. I have worked with Java since 1998 (still do for fun at home) and NEVER use any IDE. Reasons: IDE, whatever it is, robs your imagination and your contemplation with its "proposals" that are sometimes nonsensical.

The only editor I work with was JEDIT and then today with Notepad++ to develop my own Object Oriented Database, Fuzzy Logics and different tools (see pic/linux Mint) , etc. If this forum interests on my works I could post them for free.
 

Anhänge

  • screen.jpg
    screen.jpg
    55,8 KB · Aufrufe: 1

KonradN

Super-Moderator
Mitarbeiter
NEVER use any IDE
Ok, that is something that I do not understand right now. The IDE is providing a lot of functionality that helps in writing code quickly and - more important - helps finding possible errors.

But that is a point, that we do not need to discuss. It is great that you found a way to work that you like and that you prefer.
(And of course: A lot of things are available as separate tools, too. So you could integrate it into your Editor, too.)

If this forum interests on my works I could post them for free.
Yes of course. That would be quite nice just to have a look and see what ideas you had and how you build everything. Even if I prefer some other way to work, there could be some quite nice things that are at least worth to think about.

And if you are willing to share it for free: Ever thought to publish it on GitHub or any other platform that offers this service for free?

Edit: removed a typing mistake
 
Zuletzt bearbeitet:
G

Gelöschtes Mitglied 76266

Gast
Ever thought to publish it on GitHub or any other platform that offers this service for free?
Yes, but I can't because of one problem: documentation. And as you know, developer is lazy when it comes to writing documentation.
IDE is providing a lot of functionality that helps in writing code quickly and - more important - helps finding possible errors.
😂I really disagree. Developing is different than assembling. Developing is an art while assembling is just an unimaginative chore. And art is something you create and nurture. Fast coding is the success of marketing and leads often to disaster - Elster is proof of "Quick coding".
 

khmarbaise

Mitglied
Das Problem ist, dass eine Java Version verwendet wird, die niedriger als JDK17 ist... z.B. JDK16 oder weniger... weiterhin ist die maven-compiler-plugin version 3.10.1 nicht die neueste (aktuell 3.11.0) aber das spielt hier kein Rolle.... bitte die vollständige Konfiguration für maven-compiler-plugin zeigen ... eventuell einen Parent prüfen, ob da noch was gemacht wird/wurde???

Weiterhin ist das ein Spring boot projekt?
Die ganzen Properties entfernen bis auf eine: maven.compiler.release ... dann probieren...
XML:
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
<source.version>${java.version}</source.version>

Danach wenn das immer noch nicht funktioniert... würde ich vorschlagen einmal eine Online session zu machen... ich biete das gerne an... einfach kontakt aufnehmen...

Das ist doch der selbe Thread wie auf SO: https://stackoverflow.com/questions...piling-error-release-version-17-not-supported ???
 
G

Gelöschtes Mitglied 76266

Gast
Das Problem ist, dass eine Java Version verwendet wird, die niedriger als JDK17 ist... z.B. JDK16 oder weniger... weiterhin ist die maven-compiler-plugin version 3.10.1 nicht die neueste (aktuell 3.11.0) aber das spielt hier kein Rolle
That is the point. COMPILER. Which compiler? SUN, sorry, ORACLE or OpenJDK or what? I haven't worked with "Maven" but the error message is about compiler. And that leads to the most basic question about what compiler?
By default, the compiler plugin compiles source code compatible with Java 5, and the generated classes also work with Java 5 regardless of the JDK in use. We can modify these settings in the configuration element...
Maven-compiler-plugin uses by default javac of version 1.5 (see HERE) and Apace confirms it
The Compiler Plugin is used to compile the sources of your project. Since 3.0, the default compiler is javax.tools.JavaCompiler (if you are using java 1.6) and is used to compile Java sources. If you want to force the plugin using javac, you must configure the plugin option...
(more: HERE)

Because software development becomes more and more complex, developers who work with different complex packages (such as Apache Maven or Spring Framework) should always pay attention to the most basic requirements which at first glance might seem "irrelevant". As I said, software development is an art. Art always requires great attention about details -even to a "known" detail. And then you move on like you're starting to learn "Maven" for the first time.
 
Zuletzt bearbeitet von einem Moderator:

mrBrown

Super-Moderator
Mitarbeiter
That is the point. COMPILER. Which compiler? SUN, sorry, ORACLE or OpenJDK or what? I haven't worked with "Maven" but the error message is about compiler. And that leads to the most basic question about what compiler?

Well, javac. Doesn't matter if oracle or openjdk.


Maven-compiler-plugin uses by default javac of version 1.5 (see HERE) and Apace confirms it

No, it compiles the code compatible with Java 5, but it uses the current compiler that is available.

Also, Java 5 is no longer used as a standard since version 3.8. Maven Compiler 3.10.1 uses Java 7.


As I said, software development is an art. Art always requires great attention about details -even to a "known" detail. And then you move on like you're starting to learn "Maven" for the first time.
More like a craft where you have to know the tools.
 

khmarbaise

Mitglied
That is the point. COMPILER. Which compiler? SUN, sorry, ORACLE or OpenJDK or what? I haven't worked with "Maven" but the error message is about compiler. And that leads to the most basic question about what compiler?

By default, the compiler plugin compiles source code compatible with Java 5, and the generated classes also work with Java 5 regardless of the JDK in use. We can modify these settings in the configuration element...

That quote is not accurate. The compatibility is defined by source/target configuration (if before JDK9 otherwise you should use release). If using an old maven-compiler-plugin before 3.8.0 that would be true if no source/target has been defined! That means using a maven-compiler-plugin version 3.7.0 and nothing has been defined for source/target that would mean to have Java 5 compatible classes... which is not the case here...

Maven-compiler-plugin uses by default javac of version 1.5 (see HERE) and Apace confirms it

The maven-compiler-plugin version 3.10.1 defines it's default for source/target with 1.7 (default if not overwritten by configuration which is here the case)

See here https://maven.apache.org/plugins-archives/maven-compiler-plugin-3.10.1/
The given link is referencing baeldung.com which is neither Apache Software Foundation nor Apache Maven Project nor the correct location of the maven-compiler-plugin ...

The Compiler Plugin is used to compile the sources of your project. Since 3.0, the default compiler is javax.tools.JavaCompiler (if you are using java 1.6) and is used to compile Java sources. If you want to force the plugin using javac, you must configure the plugin option...
The javax.tools.JavaCompiler has been introduced with JDK 6 and it's being used by the ToolProvider(SPI)..to call tools like the Javac if neede. From a users point of view it's more or less the same...technically there are some differences... it's highly unlikely that this is the problem..

Furthermore have you tried to run a build of Maven via "mvn package -X" and redirected the output to a file and searched there for "Using compiler 'javac'" in that output? You will find two times because one for production code /src/main/java and one for test code /src/test/java ...


Kind regards
Karl Heinz Marbaise
 

KonradN

Super-Moderator
Mitarbeiter
Maven-compiler-plugin uses by default javac of version 1.5 (see HERE) and Apace confirms it
But the pom sets source, target and release to 17 - so that seems correct.

Which compiler? SUN, sorry, ORACLE or OpenJDK or what?
That information is already given: Java version: 17.0.4, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-17-openjdk-17.0.4.0.8-2.el8_6.x86_64

I simply would like to get the full log (as mentioned in #4). When there is a problem with the compile plugin, then we should get all messages that the compiler plugin provides. And these should have started with a line like
[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ async-support ---

It is not enough to just provide the error summary at the end. Important messages might be before the summary (Esp. with -X option given!)
 
G

Gelöschtes Mitglied 76266

Gast
That quote is not accurate. The compatibility is defined by source/target configuration (if before JDK9 otherwise you should use release). If using an old maven-compiler-plugin before 3.8.0 that would be true if no source/target has been defined! That means using a maven-compiler-plugin version 3.7.0 and nothing has been defined for source/target that would mean to have Java 5 compatible classes... which is not the case here...



The maven-compiler-plugin version 3.10.1 defines it's default for source/target with 1.7 (default if not overwritten by configuration which is here the case)

See here https://maven.apache.org/plugins-archives/maven-compiler-plugin-3.10.1/
The given link is referencing baeldung.com which is neither Apache Software Foundation nor Apache Maven Project nor the correct location of the maven-compiler-plugin ...


The javax.tools.JavaCompiler has been introduced with JDK 6 and it's being used by the ToolProvider(SPI)..to call tools like the Javac if neede. From a users point of view it's more or less the same...technically there are some differences... it's highly unlikely that this is the problem..

Furthermore have you tried to run a build of Maven via "mvn package -X" and redirected the output to a file and searched there for "Using compiler 'javac'" in that output? You will find two times because one for production code /src/main/java and one for test code /src/test/java ...


Kind regards
Karl Heinz Marbaise
Well, javac. Doesn't matter if oracle or openjdk.

Well, as I said "I haven't worked with Maven...."
I am not sure that javac of X is the same or fully compatible with javac of Y. Btw. I am out of the JAVA active scene since 2011 after Oracle purchased SUN and open for everything about Oracle JAVA and OpenJDK

PS: The discrepancy of JVM between Linux (here Ubuntu/Mint) and Windows is for example so subtle, but hard to figure out whether the problem (or error?) is from the OS or from the JVM. People tend to blame the OS, but JAVA claims to be "Write Once Run Anywhere". So from this viewpoint JVM on Linux is "incompatible" with JVM on Windows.

Example: the KeyCode processing on Linux differs from Windows:
Java:
    // work on both Linux and Windows
    canvas.setOnKeyReleased(e -> {
      KeyCode kc = e.getCode();
      if (kc == KeyCode.ESCAPE) {
        ...
      }
      if (kc == KeyCode.BACK_SPACE) {
       ...
      }
    });
    // Won't work on Linux
   canvas.setOnKeyTyped(e -> {
      char c = e.getCharacter().charAt(0); // typed key
      if (c == 0x1B) { // ESCAPE
         ...
      }
      if (c == 0x08) { // BACK_SPACE
          ...
      }
 
Zuletzt bearbeitet von einem Moderator:

khmarbaise

Mitglied
Well, as I said "I haven't worked with Maven...."
I am not sure that javac of X is the same or fully compatible with javac of Y. Btw. I am out of the JAVA active scene since 2011 after Oracle purchased SUN and open for everything about Oracle JAVA and OpenJDK

Ever heard about the Oracle Java Compatibility Kit (JCK) which keeps code/compilation and behaviour in synch. OpenJDK and Oracle follw that also other vendors do that (apart from that OpenJDK is by Oracle) ... In earlier days there had been issues based on incompatibilites for example between IBM J9 and Oracle JDK (at the times of JDK5/6) etc. but those times are long over......

Example: the KeyCode processing on Linux differs from Windows:
Java:
    // work on both Linux and Windows
    canvas.setOnKeyReleased(e -> {
      KeyCode kc = e.getCode();
      if (kc == KeyCode.ESCAPE) {
        ...
      }
      if (kc == KeyCode.BACK_SPACE) {
       ...
      }
    });
    // Won't work on Linux
   canvas.setOnKeyTyped(e -> {
      char c = e.getCharacter().charAt(0); // typed key
      if (c == 0x1B) { // ESCAPE
         ...
      }
      if (c == 0x08) { // BACK_SPACE
          ...
      }
Really ? You blame the JVM or the Java Compiler NOT to magically cure OS dependent code ?

Keyboard code sequences are completely OS dependent (different between Linux, Windows, Mac OS, iOS, Android etc.) ...

A very "simple" example is the difference between file systems between Windows, Linux, Mac OS etc. .. The JVM (or more accurately the Java Language) has a very good abstraction which is Path etc. (NOT File!!) ..which is mapped via the JVM down to the OS level..

A very basic example is the usage of "\n" ? Which is interpreted different on different OS'es... ? There is simple solutions to handle that correctly ... System.lineSeperator()...

Apart from that I would suggest to stop that discussion because that does not help the original poster... If you like to dicuss about that topic open a different thread...

Kind regards.
Karl Heinz Marbaise
 
G

Gelöschtes Mitglied 76266

Gast
Apart from that I would suggest to stop that discussion because that does not help the original poster..
Agreed.
By the way, I'm revoking my membership of Java-Forum.org. It's a German forum and people like me should stay out of it when their German is insufficient to express something that requires more than a few lines.

To: Admins and Mods: Please delete or close my account of Java-Forum.org.
Thanks.
 

mihe7

Top Contributor
It's a German forum and people like me should stay out of it when their German is insufficient to express something that requires more than a few lines.
Yes and no. Yes, it is a German forum, so it is generally expected that comments are written in German. But, as you can see, most make an effort to discuss in English when someone writes an English comment.

A discussion in a foreign language can lead to misunderstandings, of course. In this thread, I personally see an objective discussion, e. g. @mrBrown rephrased your statement about the maven-compiler-plugin so that it is more accurate (it doesn't use the compiler of Java version 1.5 but compiles code that is compatible to Java 5) and added some information.

People tend to blame the OS, but JAVA claims to be "Write Once Run Anywhere". So from this viewpoint JVM on Linux is "incompatible" with JVM on Windows.
'Write Once, Debug Everywhere' :)

Of course, there are differences between OSs which must be handled by the developer. But there are also differences which can't be handled by the developer -> Bugs. For instance, a few years ago I faced huge problems with a project because of differing font metrics between Oracle Java 8 on Linux and Windows (as far as I remember). I attribute this to the use of distinct font renderers, namely Freetype 2 on Linux and the Windows native font renderer.
 

Neue Themen


Oben