Error java error release version 5 not supported maven

I'm using IntelliJ IDEA Ultimate 2019.3.1. Whenever I try to start any simple Java Maven project (may it be even a simple Hello World) I get the following error: Error:java: error: release version...

I’m using IntelliJ IDEA Ultimate 2019.3.1. Whenever I try to start any simple Java Maven project (may it be even a simple Hello World) I get the following error:

Error:java: error: release version 5 not supported

Running java --version by terminal I get the following output:

openjdk 11.0.5 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.1)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.1, mixed mode, sharing)

Running javac --version by terminal I get the following output:

javac 11.0.5

Going to the Settings of the Java Compiler ( as suggested here ) I see this:

Java Compiler Settings

I tried editing the «Target bytecode version» to 1.8 but I get the following errors:

Error:(1, 26) java: package javafx.application does not exist
Error:(2, 20) java: package javafx.stage does not exist
Error:(4, 27) java: cannot find symbol
  symbol: class Application
Error:(12, 23) java: cannot find symbol
  symbol:   class Stage
  location: class Main
Error:(7, 9) java: cannot find symbol
  symbol:   method launch(java.lang.String[])
  location: class Main
Error:(11, 5) java: method does not override or implement a method from a supertype

Changing it to version 1.11 I get this error instead:

Error:java: Source option 5 is no longer supported. Use 6 or later.

What do you think is the problem? How may I solve it?

asked Jan 5, 2020 at 14:54

Robb1's user avatar

2

See https://stackoverflow.com/a/12900859/104891.

First of all, set the language level/release versions in pom.xml like that:

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

Maven sets the default to 1.5 otherwise. You will also need to include the maven-compiler-plugin if you haven’t already:

<dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.8.1</version>
</dependency>

Also, try to change the Java version in each of these places:

File -> Project structure -> Project -> Project SDK -> 11.

File -> Project structure -> Project -> Project language level -> 11.

File -> Project structure -> Project -> Modules -> -> Sources —> 11

In project -> ctrl + alt + s -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Project bytecode version -> 11

In project -> ctrl + alt + s -> Build, Execution, Deployment -> Compiler -> Java Compiler -> Module -> 1.11.

answered Jan 6, 2020 at 6:48

Konstantin Annikov's user avatar

8

Took me a while to aggregate an actual solution, but here’s how to get rid of this compile error.

  1. Open IntelliJ preferences.

  2. Search for «compiler» (or something like «compi»).

  3. Scroll down to Maven —>java compiler. In the right panel will be a list of
    modules and their associated java compile version «target bytecode version.»

  4. Select a version >1.5. You may need to upgrade your jdk if one is not available.

enter image description here

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered Feb 18, 2020 at 19:17

borisveis's user avatar

borisveisborisveis

8715 silver badges2 bronze badges

7

By default, your «Project bytecode version isn’t set in maven project.

It thinks that your current version is 5.

Solution 1:

Just go to «Project Settings>Build, Execution…>compiler>java compiler» and then change your bytecode version to your current java version.

Solution 2:

Adding below build plugin in POM file:

 <properties>
        <java.version>1.8</java.version>
        <maven.compiler.version>3.8.1</maven.compiler.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered May 29, 2020 at 7:59

Arjun Marati's user avatar

I add the following code to my pom.xml file. It solved my problem.

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered Feb 19, 2020 at 15:27

Jéssica Machado's user avatar

In my case it was enough to add this part to the pom.xml file:

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

answered Dec 1, 2020 at 6:15

Krzysztof Tomaszewski's user avatar

I did everything above but had to do one more thing in IntelliJ:

Project Structure > Modules

I had to change every module’s «language level»

answered Aug 4, 2020 at 10:37

tataelm's user avatar

tataelmtataelm

5898 silver badges17 bronze badges

You should do one more change by either below approaches:


1 Through IntelliJ GUI

As mentioned by ‘tataelm’:

Project Structure > Project Settings > Modules > Language level: > then change to your preferred language level


2 Edit IntelliJ config file directly

Open the <ProjectName>.iml file (it is created automatically in your project folder if you’re using IntelliJ) directly by editing the following line,

From: <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">

To: <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_11">

As your approach is also meaning to edit this file. :)


Approach 1 is actually asking IntelliJ to help edit the .iml file instead of doing by you directly.

answered Feb 2, 2021 at 15:42

garykwwong's user avatar

garykwwonggarykwwong

2,2272 gold badges16 silver badges20 bronze badges

1

If your are using IntelliJ,
go to setting => compiler
and change the version to your current java version.

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered Apr 22, 2020 at 10:51

Sikhumbuzo Sithole's user avatar

The only working solution in my case was adding the following block to pom.xml:

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

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered May 2, 2020 at 5:44

Muhammed Gül's user avatar

1

The solution to the problem is already defined in some of the answers. But there is still a need to express a detail. The problem is totally related to maven, and the solution is also in the pom.xml configuration. IntelliJ only reads maven configuration, and if the configuration has wrong information, IntelliJ also tries to use that.

To solve the problem, as expressed in the most of the answers, just add the below properties to the pom.xml of the project.

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

After that, on the IntelliJ side, reimport maven configuration. To reimport the maven configuration, right click on pom.xml file of the project and select Reimport. Compiler version related information in IntelliJ preferences will be automatically updated according to the values in the pom.xml.

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered May 31, 2020 at 23:31

ayhan's user avatar

ayhanayhan

1191 silver badge3 bronze badges

1

You only have to add these two lines in your pom.xml. After that, your problem will be gone.

<!--pom.xml-->
<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered Mar 18, 2020 at 5:56

Mehedi Abdullah's user avatar

I had the same issue but with a small difference. My error message was the following.

IntelliJ: Error:java: error: release version 16 not supported

So in Intellij go to

  • File
  • Settings
  • Build, Execution, Deployment
  • Compiler

In here there is field called «Project bytecode version». There the default value was 16, I changed it to 8 and everything worked fine.

answered Jul 31, 2021 at 7:00

Ruchin Amaratunga's user avatar

0

If you are using spring boot as a parent, you should set the java.version property, because this will automatically set the correct versions.

<properties>
   <java.version>11</java.version>
</properties>

The property defined in your own project overrides whatever is set in the parent pom. This overrides all needed properties to compile to the correct version.

Some information can be found here: https://www.baeldung.com/maven-java-version

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered Jan 6, 2020 at 8:42

V Jansen's user avatar

2

Found one more place to change, which actually fixed for me.

Project Structure -> < Select Module > Dependencies -> Module SDK < Select version from drop down >

enter image description here

answered Jul 23, 2021 at 8:32

Manish's user avatar

ManishManish

1,09213 silver badges25 bronze badges

  1. File->Settings

enter image description here

  1. From left side ->»Build, Execution, Deployment» ->»java compiler»

enter image description here

  1. choose the project that you work on and choose the java version you need

enter image description here

answered Feb 6, 2022 at 8:29

Vladi's user avatar

VladiVladi

1,44215 silver badges28 bronze badges

1.use this properties

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

2.Add this dependency

 <dependency>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.8.1</version>
    </dependency>

3.Reload mvn

answered Aug 13, 2022 at 5:00

Biddut's user avatar

BiddutBiddut

4181 gold badge6 silver badges17 bronze badges

I’ve done most things you are proposing with Java compiler and bytecode and solved the problem in the past.
It’s been almost 1 month since I ran my Java code (and back then everything was fixed), but now the problem appeared again.
Don’t know why, pretty annoyed though!

This time the solution was:
Right click to project name -> Open module settings F4 -> Language level
…and there you can define the language level your project/pc is.

No maven/pom configuration worked for me both in the past and now and I’ve already set the Java compiler and bytecode at 12.

Dharman's user avatar

Dharman

29.3k21 gold badges80 silver badges131 bronze badges

answered Jul 15, 2020 at 15:03

Giorgos Argyriou's user avatar

1

Within IntelliJ, open pom.xml file.

Add this section before <dependencies> (if your file already has a <properties> section, just add the <maven.compiler...> lines below to that existing section):

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

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered Apr 3, 2020 at 2:44

Ali Shah's user avatar

You need to set language level, release version and add maven compiler plugin to the pom.xml

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

<dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <version>3.8.1</version>
</dependency>

answered Jan 29, 2021 at 9:41

User's user avatar

UserUser

1,31012 silver badges11 bronze badges

guys, I have also encountered this problem after having so much research on this issue I found 3 solutions to resolve this issue

  1. Add these properties in your pom.xml; //Sorry for the formatting

<properties><java.version>1.8</java.version<maven.compiler.version>3.8.1</maven.compiler.version<maven.compiler.source>1.8</maven.compiler.source<maven.compiler.target>1.8</maven.compiler.target><java.version>11</java.version></properties>

  1. Delete everything in the target byte version, you can find this in the java compiler setting of the IntelliJ

Remove everything below target byte version make it empty

  1. Find the appium version you are using in the dependency. here I am using 7.3.0
    find the version of the appium you are using in the dependency in pom.xml

Then write your version in the target byte version in java compiler
enter image description here

ENJOY THE CODE>>>HOPE IT WORKED FOR YOU

answered Aug 21, 2020 at 6:47

The_real_codder's user avatar

In IntelliJ, the default maven compiler version is less than version 5, which is not supported, so we have to manually change the version of the maven compiler.

We have two ways to define version.

First way:

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

Second way:

<build>
  <plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
            <source>8</source>
            <target>8</target>
        </configuration>
    </plugin>
  </plugins>
</build>

Pang's user avatar

Pang

9,354146 gold badges85 silver badges121 bronze badges

answered Aug 16, 2020 at 5:26

Manish Jangid's user avatar

For me in Intelij click on File -> Project Structure -> select the modules in language level select 11 - Local variable syntax for lambda parameters, click em aply.

Run in terminal mvn clean install.

Its solved my problem.

answered May 9, 2021 at 12:39

Renato Vasconcellos's user avatar

2023 update:

Kindly check your pom.xml file to know what version of java you have configured.

check you java version

<properties>
    <java.version>17</java.version>
</properties>

Then the next thing is to download jdk of the version you have configure. Follow the below step to do that.

enter image description here

  1. Click on file -> Project structure as below
  2. See the image below to add or select Project SDK
    3, You can download the specific version of your project if it is missing on the list by clicking Add SDK —> Download JDK.
    Complete download and apply and click ok to reload application.

enter image description here

answered Jan 20 at 0:18

eclat_soft's user avatar

eclat_softeclat_soft

4726 silver badges8 bronze badges

Angie Jones

A common error in IntelliJ when attempting to run a new Java maven project is Error:java: release version 5 not supported.

Here are 3 techniques to resolve this. Try them in order. If one doesn’t resolve the issue, try the next.

1. Update Java Compiler

  • Go to IntelliJ IDE menu item (or File on Windows) -> Preferences -> Build, Execution, Deployment -> Java Compiler

  • Delete value under Target bytecode version, then click OK

  • Refresh maven

  • Try running again. If problem persists, continue on to number 2 below

2. Update SDK Version

  • Go to File -> Project Structure -> Project Settings -> Project. Make sure you have the correct Java version selected. It should be the same as the one you downloaded

  • Also on this same panel, go to Platform Settings -> SDKs. Make sure you have the correct Java version selected

  • Click OK

  • Refresh maven

  • Try running again. If problem persists, continue on to number 3 below

3. Add property to pom.xml

  • Within IntelliJ, open pom.xml file

  • Add this section before <dependencies> (If your file already has a <properties> section, just add the <maven.compiler...> lines below to that existing section):

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

Enter fullscreen mode

Exit fullscreen mode

  • Change the x in 1.8 to your Java version. For example, if you’re using Java 13, change 1.8 to 1.13

  • Refresh maven

  • Try running again

What do you do when you create a new Maven Java project, and when you run it, you get the following error:

Error:java: error: release version 5 not supported

Sometimes the error could also read as follows:

java: Source option 5 is no longer supported. Use 6 or later.

Luckily for us, the solution is exactly the same!

Solution

Open the project’s pom.xml file and add the following snippet:

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

Now open the Maven side-panel, and click the Report All Maven Projects button.

You can now successfully run your new Maven Java project.

Additional Notes

The release version 5 not supported error is quite common with newly created projects.

The java error is frequently seen in IntelliJ after a new Maven project has begun and full setup has not been completed.

By default, the project bytecode version is not actually set in Java maven projects.

Therefore it believes that your current version is set to 5.

Open up Project Settings>Build,Execution…>compiler>java compiler and change your bytecode version to your current java version.

An alternative solution

If the above does not work for you when trying to solve the java error: release version 5 not supported in IntelliJ, you can attempt the following alternative:

  1. Open the IntelliJ preferences dialog.
  2. Filter the navigation items by typing compiler.
  3. Move to the Maven->Java Compiler section.
  4. In the right hand configuration panel, there is a list of modules and their accompanying Java compile versions. This is called the target bytecode version.
  5. Finally select a version bigger than 1.5.

Note that if there is no version greater than 1.5 available in the above list, then you will need to upgrade your Java Development Kit (JDK) on the local machine.

Once all of these steps have been completed, you may also want to go to the Project Structure contextual menu and select Modules. Under here you will have the option to change each of the module’s language level.

You can also always just update your pom.xml to contain the following:

<properties>
   <java.version>11</java.version>
</properties>

This will fix your java: error: release version 5 not supported problem encountered while trying to run, or execute a Maven Java application in IntelliJ IDEA.

Содержание

  1. How to fix Source option 5 is no longer supported. Use 7 or later
  2. Error
  3. Maven POM.xml
  4. Examples
  5. JDK 14
  6. Sample pom.xml file
  7. Verify the fix
  8. Maven Tutorial
  9. How to fix the Release Version 5 Not Supported error in IntelliJ
  10. Solution
  11. Additional Notes
  12. An alternative solution
  13. How to fix the Release Version 5 Not Supported error in IntelliJ
  14. Solution
  15. Additional Notes
  16. An alternative solution
  17. [SOLVED] Maven: Source option 5 is no longer supported. Use 6 or later.
  18. Situation 1: New project uses JDK 9+
  19. Solution 1: Use newer version of maven-compiler-plugin
  20. Situation 2: Full control over maven-compiler-plugin, source and target compatibility
  21. Solution 2. Set the proper maven properties
  22. Ошибка «Вариант источника 5 больше не поддерживается. Используйте 6 или новее »при компиляции Maven
  23. 4 — Устранение неполадок Java, Eclipse и Maven

How to fix Source option 5 is no longer supported. Use 7 or later

When we create Maven projects using artifacts and try to run them, we sometimes get the following error. Source option 5 is no longer supported. Use 7 or later. In this post, let’s see the steps involved to fix the error in the Maven project.

The error (Source option 5 is no longer supported) is common when we create a Maven project from the old archetypes. In this case, we need to specify the source and target version to the Maven compiler. We can specify these properties in Maven pom.xml file.

Error

The fix for the problem is to use the latest Java environment for the project that is above JDK 7 or Later.

Identify the JDK version installed on your machine or the version the IDE workspace uses. Update the project build path with the latest library settings.

Right-click Project properties >> Java Compiler.

Change the JDK compliance parameters from 1.5 -> 1.7 or above.

Click on the Execution Environments link and select the latest or suitable JDK above JDK 1.7

Click on Apply and Close button.

Maven POM.xml

Follow the below steps to avoid this error in the Maven project,

  • Check the Java compiler version. (Project-specific settings)
  • Workspace settings. (Configure Workspace settings)
  • Project build path.
  • Maven POM.xml build file.

Examples

For example, to specify JDK 8 we can add the properties like the below to the POM.xml file:

JDK 14

Change the Java compiler and the project build path. After the changes specify the JDK version in the POM.xml Maven build file.

For example, specify the JDK 14 to the Maven pom.xml.

Sample pom.xml file

Sample pom.xml file with JDK 14 version

Verify the fix

Run the Maven project. The error should be fixed now.

After changing the settings and adding the properties information to the pom.xml file. Verify by running the project. In Eclipse IDE, to build the project choose the option

Run As >> Maven Build

Maven Tutorial

Maven tutorial on this website:

For more information on the Maven build tool, visit the official website:

Источник

How to fix the Release Version 5 Not Supported error in IntelliJ

What do you do when you create a new Maven Java project, and when you run it, you get the following error:

Error:java: error: release version 5 not supported

Sometimes the error could also read as follows:

java: Source option 5 is no longer supported. Use 6 or later.

Luckily for us, the solution is exactly the same!

Solution

Open the project’s pom.xml file and add the following snippet:

Now open the Maven side-panel, and click the Report All Maven Projects button.

You can now successfully run your new Maven Java project.

Additional Notes

The release version 5 not supported error is quite common with newly created projects.

The java error is frequently seen in IntelliJ after a new Maven project has begun and full setup has not been completed.

By default, the project bytecode version is not actually set in Java maven projects.

Therefore it believes that your current version is set to 5.

Open up Project Settings > Build , Execution …> compiler > java compiler and change your bytecode version to your current java version.

An alternative solution

If the above does not work for you when trying to solve the java error: release version 5 not supported in IntelliJ, you can attempt the following alternative:

  1. Open the IntelliJ preferences dialog.
  2. Filter the navigation items by typing compiler .
  3. Move to the Maven->Java Compiler section.
  4. In the right hand configuration panel, there is a list of modules and their accompanying Java compile versions. This is called the target bytecode version .
  5. Finally select a version bigger than 1.5.

Note that if there is no version greater than 1.5 available in the above list, then you will need to upgrade your Java Development Kit (JDK) on the local machine.

Once all of these steps have been completed, you may also want to go to the Project Structure contextual menu and select Modules . Under here you will have the option to change each of the module’s language level .

You can also always just update your pom.xml to contain the following:

This will fix your java: error: release version 5 not supported problem encountered while trying to run, or execute a Maven Java application in IntelliJ IDEA.

Источник

How to fix the Release Version 5 Not Supported error in IntelliJ

What do you do when you create a new Maven Java project, and when you run it, you get the following error:

Error:java: error: release version 5 not supported

Sometimes the error could also read as follows:

java: Source option 5 is no longer supported. Use 6 or later.

Luckily for us, the solution is exactly the same!

Solution

Open the project’s pom.xml file and add the following snippet:

Now open the Maven side-panel, and click the Report All Maven Projects button.

You can now successfully run your new Maven Java project.

Additional Notes

The release version 5 not supported error is quite common with newly created projects.

The java error is frequently seen in IntelliJ after a new Maven project has begun and full setup has not been completed.

By default, the project bytecode version is not actually set in Java maven projects.

Therefore it believes that your current version is set to 5.

Open up Project Settings > Build , Execution …> compiler > java compiler and change your bytecode version to your current java version.

An alternative solution

If the above does not work for you when trying to solve the java error: release version 5 not supported in IntelliJ, you can attempt the following alternative:

  1. Open the IntelliJ preferences dialog.
  2. Filter the navigation items by typing compiler .
  3. Move to the Maven->Java Compiler section.
  4. In the right hand configuration panel, there is a list of modules and their accompanying Java compile versions. This is called the target bytecode version .
  5. Finally select a version bigger than 1.5.

Note that if there is no version greater than 1.5 available in the above list, then you will need to upgrade your Java Development Kit (JDK) on the local machine.

Once all of these steps have been completed, you may also want to go to the Project Structure contextual menu and select Modules . Under here you will have the option to change each of the module’s language level .

You can also always just update your pom.xml to contain the following:

This will fix your java: error: release version 5 not supported problem encountered while trying to run, or execute a Maven Java application in IntelliJ IDEA.

Источник

[SOLVED] Maven: Source option 5 is no longer supported. Use 6 or later.

In General, the cause of the title problem is the incompatibility between the version of JDK used in the project and properties responsible for compatibility of the source and target code. These problems often occur in tandem as it is shown on the following listing:

The tables below contain the supported values of source and target compatibility depending on the JDK version and the default source/target setting depending on the maven-compiler-plugin version.

JDK Version source compatibility version target compatibility
before JDK9 5+ 6+
JDK9+ 1.6+ 1.6+

Source and target versions supportted by JDK

Default version of maven-compiler-plugin Default version of source compatiblity Default version of target compatiblity
before 3.8.0 5 1.5
3.8.0+ 6 1.6

Default values of source/target set by maven-compiler-plugin

I marked the most common cause of the title problem in red and yellow-red. I mean – using the new version of JDK (eg JDK9), which no longer supports Java 1.5, and the old version of maven-compiler-plugin, which defaults to Java 5 for source / target compatibility.

We already know the cause of the problem, so we can move on to discussing the solutions, because they differ slightly depending on the circumstances.

Situation 1: New project uses JDK 9+

This is the most common situation in which we can get the title errors. It will probably result from the fact that the default projects created do not set source / target compatibility, and in addition it uses an older version of maven-compiler-plugin (older than 3.8.0).

Solution 1: Use newer version of maven-compiler-plugin

We can take advantage of the fact that maven-compiler-plugin starting from 3.8.0 defaults source/target to Java 6 and just explicitly points to the newer version of the plugin. To do this, edit the pom.xml file by adding or updating the section below.

If your application does not need to be compatible with such an old version of Java as 1.6, you can immediately set this value to e.g. 11, to be able to enjoy all the benefits of Java 11.

Situation 2: Full control over maven-compiler-plugin, source and target compatibility

If you want to use a specific version of maven-compiler-plugin or you just want full control over source and target compatibility, you can use the solution below.

Solution 2. Set the proper maven properties

In that case, you can add the following section to pom.xml, which will set the value of source / target compatibility to the value you want – in this case, Java 11 compatibility.

At the end… May I ask you for something?

If I helped you solve your problem, please share this post. Thanks to this, I will have the opportunity to reach a wider group of readers. Thank You

Источник

Ошибка «Вариант источника 5 больше не поддерживается. Используйте 6 или новее »при компиляции Maven

4 — Устранение неполадок Java, Eclipse и Maven

Я получаю следующую ошибку или компилирую $ mvn:

Вот код моего pom.xml:

Я попытался добавить свойства в код pom.xml, но все равно получаю ту же ошибку. Может ли кто-нибудь помочь мне в решении этой проблемы? заранее спасибо

  • Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile это довольно старая версия. Также рассмотрите возможность перехода на 3.8.0. И в этом случае вы можете начать использовать свойство maven.compiler.release = 6 , который является предпочтительным способом компиляции, хотя требует JDK 9 и выше.
  • Я пробовал добавить

org.apache.maven.plugins плагин компилятора maven 3.8.0 6 1.8

  • Но по-прежнему появляется ошибка @RobertScholte
  • У меня была такая же проблема, проблема со свойствами. Проверьте свою версию JavaSE в своем проекте, она будет отображаться рядом с папкой системной библиотеки JRE в вашем проекте. Если он равен 1,5, то выдаст ошибку. Скорее всего, у вас будет обновленная версия, поэтому проверьте версию и обновите ее. Я обновил его ниже на основе вашего кода.

    Мне помогли эти строки в файле pom.xml

    • 1 Это действительно помогло мне Спасибо
    • Хотел бы я увидеть это первым!
    • Это ничего не дало мне .
    • Замените 1.8, например, 11, если вы нацеливаетесь на jdk 11

    Также в одном из моих проектов, помимо всех вышеперечисленных ответов, работает еще одна попытка: просто измените Уровень языка в разделе «Модули» Структура проекта [изображение ниже] [

    • 3 Это необъяснимое вуду, из-за которого хочется сменить карьеру

    Я думаю, вы ошиблись в своем pom.xml:

    Теперь, в зависимости от того, используете ли вы командную строку, используйте:

    или в любом случае (eclipse ide)

    Щелкните правой кнопкой мыши проект Run with maven> build> Goal (compile)

    • 1 [Не верно] . Недопустимый исходный и целевой выпуск «1.11». Это должно быть 11, а не 1,11.
    • У меня такая же ошибка. Я использовал java 11 и генерировал код, совместимый с 1.8. установка обоих свойств на 1,8 устранила проблему. Я использовал команду mvn clean package для создания файла jar.

    Мне это помогло:

    1. Щелкните правой кнопкой мыши Project.
    2. Щелкните Путь сборки.
    3. Щелкните Настроить путь сборки.
    4. Он открывает окно пути сборки Java.
    5. Щелкните Компилятор Java слева.
    6. Он переходит в окно компилятора Java, чтобы установить уровень соответствия компилятора в соответствии с вашей версией jre (например, если версия java — 1.8, тогда выберите 1.8) в качестве выбора.
    7. Нажмите кнопку [Применить].
    8. Щелкните по кнопке [OK].
    9. Щелкните правой кнопкой мыши Project> Maven> Обновить проект.
    10. Щелкните правой кнопкой мыши Project> Run As> Maven install — файл pom.xml запущен, java-файлы загружаются и устанавливаются в проект.
    11. Щелкните правой кнопкой мыши Project> Run As> Maven Test — файл pom.xml запущен, java-файлы загружаются и устанавливаются в проект.

    Затем вы получили сообщение об успешной сборке, и ваш проект maven успешно создан.

    • 1 Eclipse может делать это автоматически. Шаг № 9 должен быть единственным, что нужно сделать, если JDK поддерживает 1.8.

    Для нового сетевого компонента Apache он немного отличается от предложения SUPARNA SOMAN.

    • Щелкните правой кнопкой мыши свой проект — нажмите » set configuration «и щелкните customize configuration -Откроется новое диалоговое окно .
    • В левом углу, где находятся категории, нажмите » Source ‘
    • В форме выбора на странице ниже выберите необходимую версию JDK —- см. Изображение для этого последнего шага. Последний шаг, необходимый для изменения версии jdk

    У меня была такая же проблема, и я добавил ниже конфигурацию в pom.xml, и она работает.

    • Это устранило мою проблему с запуском sonarqube

    На MacOS у меня несколько версий

    и JAVA_HOME не был определен должным образом, поэтому Maven использовал jdk-12. У меня jdk-11, jdk-8 и jdk-12.

    Определить JAVA_HOME использовать jdk-8.

    Попробуйте еще раз, теперь maven:

    Вот решение, которое мне помогло:

    У меня была такая же проблема с источником ошибки, вариант 5 больше не поддерживается, используйте 6 или новее

    Итак, я выполнил эти инструкции и проблема Решено

    1. Открыть свойства проекта (меню «Файл»)
    2. Измените исходный / двоичный формат на последнюю версию (JDK 7 в моем случае)

    Свойства проекта

    Исходный / двоичный формат

    Очистите и соберите, затем запустите проект

    Источник

    Hello Guys, How are you all? Hope You all Are Fine. Today I am just trying to run my simple java maven project in my IntelliJ IDEA Ultimate And I am facing the following error Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate. So Here I am Explain to you all the possible solutions here.

    Without wasting your time, Let’s start This Article to Solve This Error.

    Contents

    1. How Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate Occurs ?
    2. How To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate?
    3. Solution 1: Change target bytecode version
    4. Solution 2: Add this code in build plugin in POM file
    5. Solution 3 : try to change the Java version
    6. Summery

    Today I am just trying to run my simple java maven project in my IntelliJ IDEA Ultimate And I am facing the following error.

    Error:java: error: release version 5 not supported

    How To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate?

    1. How To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate?

      To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate Open Your IDE Setting. Then Open Build Execution, Deployment Then Select Compiler. Then Just Scroll down to Maven and java compile In the right panel will be a list of modules and their associated java compile version “target bytecode version.” Select a version >1.5. You may need to upgrade your JDK if one is not available. Preferences > Build, Execution, Deployment > Compiler > Java Compiler > Target bytecode version. Setting this value fixed the error for me

    2. Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate

      To Solve Error:java: error: release version 5 not supported in IntelliJ IDEA Ultimate Open Your IDE Setting. Then Open Build Execution, Deployment Then Select Compiler. Then Just Scroll down to Maven and java compile In the right panel will be a list of modules and their associated java compile version “target bytecode version.” Select a version >1.5. You may need to upgrade your JDK if one is not available. Preferences > Build, Execution, Deployment > Compiler > Java Compiler > Target bytecode version. Setting this value fixed the error for me

    Solution 1: Change target bytecode version

    1. Open Your IDE Setting.
    2. Then Open Build Excecution, Deployment
    3. Then Select Compiler.
    4. Then Just Scroll down to Maven and java compile
    5. In the right panel will be a list of modules and their associated java compile version “target bytecode version.”
    6. Select a version >1.5.
    7. You may need to upgrade your jdk if one is not available.
    8. Preferences > Build, Execution, Deployment > Compiler > Java Compiler > Target bytecode version. Setting this value fixed the error for me

    Solution 2: Add this code in build plugin in POM file

     <properties>
            <java.version>1.8</java.version>
            <maven.compiler.version>3.8.1</maven.compiler.version>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
        </properties>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                    </configuration>
                </plugin>
            </plugins>
        </build>

    Solution 3 : try to change the Java version

    Here First of all set the language level/release versions in pom.xml Like this.

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

    Then Just try to change the Java version.

    1. Go to File -> Select Project structure -> Select Project -> Then Project SDK -> set It to 11
    2. Go to File -> Select Project structure -> Select Project -> Select Project language level  -> set to 11
    3. Go to File -> Select Project structure -> Select Project -> Select Modules -> select Sources  -> set it to 11
    4. Go to setting -> Open Build, Execution, Deployment -> Slect Compiler -> Then select Java Compiler -> Change Project bytecode version to 11
    5. Go to setting -> Open Build, Execution, Deployment -> Slect Compiler -> Then select Java Compiler -> Select Module -> Change it to 11

    Summery

    It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

    Also, Read

    • SyntaxError: invalid syntax to repo init in the AOSP code.

    Понравилась статья? Поделить с друзьями:
  • Error java source option 5 is no longer supported use 6 or later
  • Error java outofmemoryerror insufficient memory
  • Error java net unknownhostexception unable to resolve host
  • Error java lang verifyerror inconsistent stackmap frames at branch target 47
  • Error java awt