1

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
r-uu
  • 423
  • 1
  • 4
  • 18
  • 1
    This error is basically getting passed through straight from the javac compiler. You'll get an error if you do a plain `javac --source M --release N My.java` command. What are you trying to do exactly? I think typically you should only need the newer '--release N' option and not the `--source M` option. – Scott Kurz Mar 29 '22 at 16:38
  • I do not know what might be the reason for this --source M --release N mismatch. As far as I can see I have everything (M and N) in place for java 17. I have a minimal reproducer [here](https://github.com/r-uu/ruu.io/tree/master/app/lab/openliberty). As soon as liberty detects a .java file in the source directory it starts (as expected) to compile but always throws the mentioned error. However, compilation itself seems to succeed as there is a .class in the target directory!? – r-uu Mar 30 '22 at 08:14
  • 1
    I looked into it more and didn't realize that `mvn compile` will work just fine with a combination of "source" and "release" properties/parameters. I think we might want the liberty:dev goal to work the same so I opened issue: https://github.com/OpenLiberty/ci.maven/issues/1467 to consider fixing this as a bug. – Scott Kurz Mar 30 '22 at 12:27
  • 1
    As far as your original problem, you can probably just delete the 'maven.compiler.source', 'maven.compiler.target' props and use the release value however you have it configured and it will probably do what you want. However, the "reproducer" link you pasted doesn't seem to be working so it's not clear what you're trying to do. If you want to share more detail about what you're trying to do I can take a quick look. – Scott Kurz Mar 30 '22 at 12:28
  • Thanks for having a look and sorry, I messed up the reproducer when I continued work. I cleaned up and now it shows the behaviour that you described in the issue. – r-uu Mar 31 '22 at 07:29
  • 1
    OK, no problem. Were you able to workaround the problem for now, e.g. by deleting the source config ? – Scott Kurz Mar 31 '22 at 12:00
  • The reproducder throws an error as soon as either maven.compiler.source or maven.compiler.target is used together with maven.compiler.release even if the version numbers are aligned. I decided to continue with maven.compiler.release=17 only. – r-uu Apr 01 '22 at 05:11
  • This problem also occurs if you work in a maven-multi-module-project and source or target are used in parent projects. – r-uu Apr 01 '22 at 05:14
  • 1
    That makes sense (what you said about multi-module projects). So do you need any more help working around this or have you been successful dealing with this issue? – Scott Kurz Apr 01 '22 at 11:27
  • So I can not use openliberty in my maven-multi-module but I can live with that for now. – r-uu Apr 01 '22 at 14:22
  • 1
    Hmm..are you saying you can't use Open Liberty in multi-module because of the liberty-maven-plugin issue 1467? (Couldn't you just override using the source+target options rather than release?) Or maybe it's some unrelated reason? Well, feel free to reach out on our Gitter channel: https://gitter.im/OpenLiberty/developer-experience if we can help (you just need a GitHub id). – Scott Kurz Apr 01 '22 at 14:25
  • Yes, I did not come up with the idea of property overriding. Overriding release works in my case. – r-uu Apr 01 '22 at 16:28

1 Answers1

0

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.

r-uu
  • 423
  • 1
  • 4
  • 18