Issue
Build fails with "invalid target release: 11" message.
After a commit to bitbucket, a pipeline job starts automaticly but fails with
Full Error Message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project sms-commons: Fatal error compiling: invalid target release: 11 ->
How to enable java 11 support?
image: maven:3.3.9
pipelines:
default:
- step:
caches:
- maven
script: # Modify the commands below to build your repository.
- mvn -B verify # -B batch mode makes Maven less verbose
- mvn clean install
I expect a successfull build, but as I wrote the build job fails.
Solution
You need to use a newer version of the maven Compiler Plugin
org.apache.maven.plugins maven-compiler-plugin 3.8.0
And you need a maven Docker image that is providing java 11 for example maven:3-jdk-11
Answered By - Thomas
Answer Checked By - Clifford M. (JavaFixing Volunteer)