Incompatible targetCompatibility

Hi. I have a project with JDK17 (sourceCompatibility = JavaVersion.VERSION_17) and Runtime Java8 (
targetCompatibility = JavaVersion.VERSION_1_8 + options.release.set(8)).

But there’s a dependency, which seems not accept targetCompatibility = JavaVersion.VERSION_1_8 and options.release.set(8). If I set them, then there’s a error:
https://pastebin.ubuntu.com/p/pn8ggC4vkP/

Is it possible to compile with targetCompatibility Java8?

Even if you could compile your project with target compatibility Java 8, as your project needs that library, it would then fail at runtime if you try to run with Java 8, because that library has a minimum Java version of Java 17. So if you really need that library, there is not much point in supporting Java 8 in your project, is there?

Some client doesn’t contain that library, and if not, my project will do nothing with it.
If contains, I need to execute some methods (frequently).

Maybe you should make a Java 17 feature variant of your library then where only that feature variant needs thus library.

I wander if we can make all features in one project and that’s easy to maintain.

OK the solution is to add a wrapper module.