2

invalid target release: 12

mvn -version Apache Maven 3.6.1

Here is my JAVA

# which java
/usr/bin/java
# java -version
openjdk version "12.0.2" 2019-07-16

And pom.xml code

<properties>
    <maven.compiler.source>12</maven.compiler.source>
    <maven.compiler.target>12</maven.compiler.target>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>                    <useIncrementalCompilation>true</useIncrementalCompilation>
                <compilerArgs>
                    <arg>-parameters</arg>
                    <arg>-Xlint:unchecked</arg>
                    <arg>--enable-preview</arg>
                </compilerArgs>
            </configuration>
        </plugin>

How ot achieve normal build?

Arthur
  • 575
  • 3
  • 8
  • 16
  • 1
    What happens if you use version `3.8.1` of the `maven-compiler-plugin` instead? – Jacob G. Aug 09 '19 at 15:38
  • [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project xenoss-account-api: Fatal error compiling: error: release version 12 not supported -> [Help 1] – Arthur Aug 09 '19 at 19:39
  • Did you see [Maven 3.8.0 Compiler - Fatal error compiling: release version 11 not supported](https://stackoverflow.com/q/51631346/1744774)? – Gerold Broser Aug 10 '19 at 00:24
  • it is set to another, but also 12 java: # echo $JAVA_HOME-> /usr/java/jdk-12.0.2 – Arthur Aug 10 '19 at 20:26

1 Answers1

2

You need to reference the Version in the plugin

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.0</version>
    <configuration>
        <release>12</release> 
    </configuration>
</plugin>

like here Unable to compile simple Java 10 / Java 11 project with Maven

Phash
  • 428
  • 2
  • 7
  • [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project xenoss-account-api: Fatal error compiling: error: release version 12 not supported -> [Help 1] – Arthur Aug 09 '19 at 19:39
  • Probably you need to update your maven-compiler-plugin to the newest version. – J Fabian Meier Aug 11 '19 at 14:26