spring-projects-experimental / spring-fu

Configuration DSLs for Spring Boot
Apache License 2.0
1.67k stars 139 forks source link

Bring back Java 8 compatibility #338

Closed pull-vert closed 3 years ago

pull-vert commented 3 years ago

Last releases are made with Java 11, making them not usable in Java 8 projects.

Was it deliberate because of some Java 11 only dependencies, or could it be switched back to be Java 8 compatible like Spring 5.x is ?

sdeleuze commented 3 years ago

Last releases require to be compiled with Java 11 (Java 17 LTS next year) because we want to use latest Java improvements on JaFu side (tests and samples) but we are expected to target Java 8 bytecode compatibility on KoFu, JaFu and autoconfigure-adapter sides.

Could you check and detail how you saw that Java 8 compatibility is broken?

pull-vert commented 3 years ago

Maybe I configured something wrong, I noticed this change because I have a test project for my libraries that I keep configured in Java 8 to ensure backward compatibility.

To simply reproduce the problem, I used your sample project "kofu-servlet-minimal", defined a JDK8 in IntelliJ.

When I do the gradle "build" task I get this error :

Execution failed for task ':compileKotlin'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not resolve org.springframework.fu:spring-fu-kofu:0.4.3-SNAPSHOT.
     Required by:
         project :
      > No matching variant of org.springframework.fu:spring-fu-kofu:0.4.3-SNAPSHOT:20201117.145209-4 was found. The consumer was configured to find an API of a library compatible with Java 8, preferably in the form of class files, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
          - Variant 'apiElements' capability org.springframework.fu:spring-fu-kofu:0.4.3-SNAPSHOT declares an API of a library, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
              - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
          - Variant 'runtimeElements' capability org.springframework.fu:spring-fu-kofu:0.4.3-SNAPSHOT declares a runtime of a library, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
              - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
sdeleuze commented 3 years ago

Ok thanks I will have a look that's not expected.

sdeleuze commented 3 years ago

@pull-vert Good catch it was due to https://docs.gradle.org/current/userguide/upgrading_version_5.html#automatic_target_jvm_version, see related https://youtrack.jetbrains.com/issue/KT-35003 issue. It is now fixed thanks to @fteychene.

pull-vert commented 3 years ago

Very nice ! Thanks :+1: