Platform 2.0: & Java 8 support

I see that we have added a 2.0-omod subproject to the to provide support for Platform 2.0.

This new 2.0-omod subproject is compiled using Java 8, assumedly because Platform 2.0 will require Java 8.

Two points:

  1. I assume that if the module is loaded in a version prior to Platform 2.0 that doesn’t have Java 8 installed, it won’t fail, but has this been confirmed?

  2. Running a “mvn clean install” now requires Java 8 to be installed. Are we requiring that all developers (and CI servers) building have Java 8 installed, or is there an easy way to say “exclude this submodule” when building?


I don’t think we should build any of the community supported modules with Java 8 as long as any of the platform 1.x release lines are still supported.

Arguably we could change earlier once the “most common implementation” is on platform 2.x. But that is still a long way off.

@raff Is compiling the 2.0-omod against Java 8 strictly necessary? Is there any workaround?

Thanks, Mark

Mark, the first scenario does work. devtest01 is running on Java 7 and the SNAPSHOT is loaded there.

The second is possible by declaring a maven profile for Java 8. The default config would not include 2.0-omod submodule in the modules section so that it is skipped when building. It won’t be included in the produced omod either. Only by enabling -Pjava8 you would have the 2.0-omod added.

Unfortunately, if we want to run any tests against openmrs-api 2.0.0-SNAPSHOT, we need to use Java 8 to build the submodule. See logs for and this line in particular:

build 23-Oct-2015 09:35:55 Caused by: java.lang.UnsupportedClassVersionError: org/openmrs/web/test/BaseModuleWebContextSensitiveTest : Unsupported major.minor version 52.0

If I remove tests then we can still build it against Java 6.

@raff I see that you switched back the omod-2.0 submodule to build against 1.6, but now the test fails, as you mention. This doesn’t seem like the ideal solution.

Am I correct that the way you had it previously, only omod-2.0 was compiled against Java 8, the rest was compiled against Java 7 (or 6)?

This seems fine to me, as long as we add a profile that allows the exclusion of omod-2.0. (I think it is better to have a -Pjava6 that excludes omod-2.0 and include omod-2.0 by default rather than having a -Pjava8 profile the includes it and then exclude it by default).

@darius @mseaton would this work for you?

Take care, Mark

Yes, only the omod-2.0 submodule is compiled with the source and target set to Java 8, thus requiring JDK 8. The rest can be compiled using JDK 6 or above as the source and target remain Java 6.

As long as the module loads and runs correctly in OpenMRS Platform 1.x under Java 6, and also in OpenMRS Platform 2.x under Java 8, that’s fine.

It shouldn’t be a big deal for PIH (and whoever else) to also install Java 8 on their CI servers. And it also seems fair to expect devs working on the core platform (including to have Java 8.

I think legacyui module needs to be compiled against java 8