Issues with Java Compatibility and Maven Errors in patient-flags Module


I’ve encountered several issues while trying to update the patient-flags module, particularly in relation to the cql-api module, and I wanted to check if I’m using them correctly or if there’s a known compatibility issue.

Initially, to run the patient-flags module, I compiled the cql-api module with Java 11 and installed the generated JAR into my local Maven repository. However, this necessitated switching the patient-flags module to Java 11 as well, which led to a series of problems:

Encoding Issue: I encountered a MalformedInputException related to resource filtering:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.3.1:resources (default-resources) on project patientflags-api: filtering C:\Users\ryanm\IdeaProjects\op
enmrs-module-patientflags\api\src\main\resources\ to C:\Users\ryanm\IdeaProjects\openmrs-module-patientflags\api\target\classes\ failed with MalformedInputException: Input length = 1 -> [Help 1]

I resolved this by setting the encoding to ISO-8859-1 during compilation:

mvn compile -D"" -D"project.reporting.outputEncoding=ISO-8859-1"

Maven Dependency Plugin Error : Next, I encountered an error with maven-dependency-plugin unpacking dependencies:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.6.0:unpack-dependencies (Expand moduleApplicationContext and messages) on project patientflags-omod: Artifact has not been packaged yet. When used on reactor artifact, unpack should be executed after packaging: see MDEP-98. -> [Help 1]

This appears to be related to MDEP-98, for which I used mvn package and install as a workaround.

As a workaround I used mvn package and install.

Test Failures : Subsequently, all tests began to fail with ArrayIndexOutOfBoundsException , which might be related to Java 11. The errors are detailed here: Test Failures Log.

Could you advise if there’s a way to develop and run this module with Java 8, or if there are specific steps to ensure compatibility with Java 11?

Thank you for your help!

For now, just remove the dependency from the cql-api module and its related classes. Then compile on Java 8

I have just removed that dependency and committed.

1 Like

Great thank you!