Coding⏱️ 3 min read📅 2026-06-03

How to Fix: Error "Source option 5 is no longer supported. Use 6 or later" on Maven compile

Maven compile error: Source option 5 is no longer supported. Use 6 or later.

Quick Answer: Update the Maven compiler plugin to version 3.8 or later in your pom.xml file.

The error 'Source option 5 is no longer supported. Use 6 or later' on Maven compile occurs when the project's source level is set to 5, which is an outdated version. This issue affects developers who use Maven for their Java projects and have not updated their build configuration.

This error can be frustrating because it prevents the compilation process from completing successfully. However, with a simple update to the Maven compiler plugin, this issue can be resolved.

💡 Why You Are Getting This Error

  • The primary cause of this error is that the project's source level has not been updated to a supported version. The Maven compiler plugin requires at least source level 6 to function correctly.
  • Another possible reason for this error could be due to an incorrect configuration in the pom.xml file, specifically the compiler plugin's source and target options.

🛠️ Step-by-Step Verified Fixes

Updating the Source Level

  1. Step 1: Open the pom.xml file and locate the compiler plugin section.
  2. Step 2: Update the source level from 5 to 6 by changing the following line: 5 to 6.
  3. Step 3: Save the changes to the pom.xml file and try compiling the project again using $ mvn compile.

Checking Compiler Plugin Configuration

  1. Step 1: Verify that the compiler plugin's target level is set correctly. The target level should be at least 1.6.
  2. Step 2: Check if there are any other configuration issues in the pom.xml file that could be causing the error.
  3. Step 3: If necessary, update the pom.xml file with the correct configuration and try compiling the project again.

✨ Wrapping Up

By updating the source level to a supported version or checking the compiler plugin's configuration, this error can be resolved. Remember to always keep your build configuration up-to-date to avoid such issues in the future.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions