ocpsoft / rewrite

OCPsoft URL-Rewriting Framework
http://ocpsoft.org/rewrite/
Apache License 2.0
189 stars 86 forks source link

Cannot build branch `develop-jakartaee-9` with JDK 11 #346

Closed poikilotherm closed 2 years ago

poikilotherm commented 2 years ago

Thanks everyone involved with #304

While trying to update to EE 10 I noticed I could not fully build the packages using Java 11 LTS only. Looks like this slipped through because of the Github Action using JDK 17 and 18 only.

Maven Enforcer also forbids rewrite-integration-spring to be executed with JDK 11.

It fails at rewrite-config-prettyfaces:

[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ rewrite-config-prettyfaces ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.ocpsoft.pretty.faces.beans.ActionExecutorTest
[ERROR] Tests run: 8, Failures: 0, Errors: 8, Skipped: 0, Time elapsed: 0.083 s <<< FAILURE! - in com.ocpsoft.pretty.faces.beans.ActionExecutorTest
[ERROR] testShouldExecuteOnNonPostback(com.ocpsoft.pretty.faces.beans.ActionExecutorTest)  Time elapsed: 0.022 s  <<< ERROR!
java.lang.UnsupportedClassVersionError: org/apache/commons/logging/LogFactoryService has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0
    at com.ocpsoft.pretty.faces.beans.ActionExecutorTest.<init>(ActionExecutorTest.java:30)

On a related note I see that the release to Maven Central is also done using Java 17. I'm not sure this will retain compatibility with JDK 11 using projects. Jakarta EE 10 requires JDK 11 minimum.

poikilotherm commented 2 years ago

Looks like downgrading Spring to current release 5.3.22 and relaxing the JDK version requirement of the module made the build run on 11 again.

We could add a profile to activate when testing with JDK 17 to include Spring 6.0.0-M4...

poikilotherm commented 2 years ago

Rethinking, it might be wiser to go for an enforcer rule to require compilation with JDK 17 in the rewrite-parent.

That way, the Spring integration will be compatible, which is nice. In the same go, the rewrite-parent should add a Maven Compiler config to use release instead of source/target. And anyway trying to compile with JDK 11 (like me on first tries) will fail early, avoiding strange errors.

larsgrefer commented 2 years ago

Spring 5.x is not compatible with Jakarta EE 9, that's why I updated to Spring 6 for the develop-jakartaee-9 branch. Spring 6 in turn is compiled against JDK 17, that's why Java 17 is needed for compilation.

lincolnthree commented 2 years ago

@poikilotherm Hmm. An enforcer rule in parent would be my preference I think. Was this issue addressed in your PR, or do we still need to decide and take action on this?

poikilotherm commented 2 years ago

The enforcer rule is in place in the EE10 branch

lincolnthree commented 2 years ago

Do we need to take any more action on this issue? I believe the creation of the ee10 branch should resolve this?

poikilotherm commented 2 years ago

Yes, I agree on that. I'll close this one as solved. Thanks!