Search code examples
compiler-errorsopen-liberty

open-liberty in dev mode throws "Error compiling Java files: error: option --source cannot be used together with --release" even for "empty" projects


I'm just starting to explore openliberty, so maybe there is something trivial I did not see.

The project is generated by https://openliberty.io/start/ with java version 17, jakarta ee 9.1 and microprofile 5.0 options.

environment:

  • open liberty: 22.0.0.3
  • jdk: OpenJDK Runtime Environment GraalVM CE 22.0.0.2 (build 17.0.2+8-jvmci-22.0-b05)
  • maven: 3.8.5

Solution

  • For the time being (see environment info in the question) mvn liberty:dev throws an error if maven.compiler.source or maven.compiler.target is used together with maven.compiler.release even if the version numbers are aligned. So you either have to use

    • maven.compiler.source and/or maven.compiler.target without maven.compiler.release or
    • maven.compiler.release without maven.compiler.source and/or maven.compiler.target

    If you are working in a maven-multi-module project where the above properties were defined in parent modules you can workaround this issue by overriding the properties appropriately.