Skip to content

UIFR-226: Update to OpenMRS platform 2.7.3 and Support Java 21 #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 19, 2025

Conversation

wikumChamith
Copy link
Member

@wikumChamith wikumChamith force-pushed the UIFR-226 branch 3 times, most recently from 28699df to 5d5c92e Compare May 1, 2025 10:55
@wikumChamith wikumChamith requested review from dkayiwa, mogoodrich, mseaton and ibacher and removed request for dkayiwa May 1, 2025 11:05
@wikumChamith
Copy link
Member Author

I'm encountering a test error when running with Java 17, but the same tests pass without issues on Java 21 and Java 24. Any idea what might be causing this?

https://gist.github.com/wikumChamith/c207c6b890e88e42c0f8ee4bd00a6297

@ibacher
Copy link
Member

ibacher commented May 1, 2025

The most common cause I see from a quick search is having the wrong version of byte-buddy on the classpath... It needs 1.12+. Alternatively, maybe we can drop the dependency on PowerMock? It only seems to be used for this import and is notoriously fragile to version changes.

Copy link
Member

@mseaton mseaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me @wikumChamith , nice work. A few comments for consideration

@@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
java-version: [8, 11, 17]
java-version: [8, 11, 21, 24]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to figure out why 17 doesn't work, and fix it and support it.

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<artifactId>javax.servlet-api</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we eliminate the need for this dependency in the api module while we are at this? Not really in the scope of this ticket, but generally the API should not have this kind of web dependency.

pom.xml Outdated
@@ -43,17 +37,17 @@
</modules>

<properties>
<openmrsPlatformVersion>2.0.0</openmrsPlatformVersion>
<springVersion>4.1.4.RELEASE</springVersion>
<openmrsPlatformVersion>2.7.3</openmrsPlatformVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be 2.7.0, or does it need to be 2.7.3?

pom.xml Outdated
<openmrsPlatformVersion>2.0.0</openmrsPlatformVersion>
<springVersion>4.1.4.RELEASE</springVersion>
<openmrsPlatformVersion>2.7.3</openmrsPlatformVersion>
<springVersion>5.3.30</springVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still used?

<target>1.7</target>
<source>1.7</source>
<target>1.8</target>
<source>1.8</source>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should this just be 8 now?

Copy link
Member Author

@wikumChamith wikumChamith May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need to set the source to at least Java 8 to compile with Java 21.

@wikumChamith
Copy link
Member Author

The most common cause I see from a quick search is having the wrong version of byte-buddy on the classpath... It needs 1.12+. Alternatively, maybe we can drop the dependency on PowerMock? It only seems to be used for this import and is notoriously fragile to version changes.

I tried adding both byte-buddy and byte-buddy-agent, but still got the error. Adding powermock as an exclusion worked.

@ibacher
Copy link
Member

ibacher commented May 1, 2025

Is there a reason we're testing with Java 24? I'd prefer not to make things dependent on non-LTS releases of the JDK, as they generally have a 6-month lifespan and are then retired.

@wikumChamith
Copy link
Member Author

Is there a reason we're testing with Java 24? I'd prefer not to make things dependent on non-LTS releases of the JDK, as they generally have a 6-month lifespan and are then retired.

I decided to add this because now we have a Java 24 build in core: openmrs/openmrs-core@2aa544c.

In the last platform meeting, @dkayiwa explained that we should try to support the latest version of JDK even if it is not an LTS.

<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.15.10</version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you add scope to these?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wikumChamith did you see the above comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I'll update this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkayiwa I updated the PR.

@wikumChamith wikumChamith force-pushed the UIFR-226 branch 2 times, most recently from 37f1231 to 473a4f8 Compare May 12, 2025 05:52
@wikumChamith
Copy link
Member Author

@dkayiwa, @ibacher, any guesses on what is causing the error with the GitHub build? I am not seeing this error when compiling the module locally.

@dkayiwa
Copy link
Member

dkayiwa commented May 13, 2025

I get the same exact error when i compile locally

@wikumChamith
Copy link
Member Author

I get the same exact error when i compile locally

Here is my log: https://pastebin.com/Lrgb6sj5

@dkayiwa
Copy link
Member

dkayiwa commented May 13, 2025

@wikumChamith try changing the failing test's base class to org.openmrs.web.test.jupiter.BaseModuleWebContextSensitiveTest and the Test annotation to org.junit.jupiter.api.Test

@wikumChamith
Copy link
Member Author

@wikumChamith try changing the failing test's base class to org.openmrs.web.test.jupiter.BaseModuleWebContextSensitiveTest and the Test annotation to org.junit.jupiter.api.Test

That fixed the issue. Do you know why I was not getting the error locally?

@dkayiwa
Copy link
Member

dkayiwa commented May 14, 2025

Where you compiling from your IDE?

@wikumChamith
Copy link
Member Author

Where you compiling from your IDE?

Tried on both the IDE and terminal.

@dkayiwa
Copy link
Member

dkayiwa commented May 14, 2025

Did you try with more than one version of Java?

@wikumChamith
Copy link
Member Author

Did you try with more than one version of Java?

Yeah, Java 8,17,21 and 24. Anyway your suggestion fixed the issue on GitHub :)

@dkayiwa
Copy link
Member

dkayiwa commented May 19, 2025

Are we going to create a branch for lower platform versions? And also bump the version of the module?

@wikumChamith wikumChamith requested a review from dkayiwa May 19, 2025 09:55
@wikumChamith
Copy link
Member Author

Are we going to create a branch for lower platform versions? And also bump the version of the module?

Yes. I created a new branch: https://github.com/openmrs/openmrs-module-uiframework/tree/3.x

@dkayiwa dkayiwa merged commit ba0dc6b into openmrs:master May 19, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants