Bazel: FlywayDB java.lang.UnsupportedClassVersionError

flexxxit :

I am using bazel to run a java8 project. I get the following with exception with flywaydb version 5.1.4. I understand what the error says but I do not want to use java 9. I want to stick to java8. Does that mean i need to downgrade flywaydb or what? Also why is the class loader loading java9 files in the first place anyway.

java.lang.UnsupportedClassVersionError: module-info has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0

How do i get around this without using java9. Perhaps this had to do with bazel...I did not have this problem when i used maven with flywaydb version

Eugene :

This is little to do with libraries that you use; to put it simple: you have a class that has been compiled with java -9 (thus 53) and you try to run it on an environment that can only handle up to 52 versions.

You also have module-info in there, which implies modularization, thus higher than java-8. If the error comes from a class from a library, like flywaydb - simply downgrade to the latest java-8 supported artifact.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=107507&siteId=1