Mvn Clean Install throws exception. Why?

Am getting exception while running mvn clean install against module. Does the module support Apache Maven 3.6.3

What does this command return? mvn -v

mvn -v returns:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/apache-maven-3.6.3
Java version: 13.0.2, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-13.0.2
Default locale: en_US, platform encoding: UTF-8
OS name: “linux”, version: “5.0.0-32-generic”, arch: “amd64”, family: “unix”

Can you try running it with Java 8 rather than Java 13?

java -version returns:
openjdk version “1.8.0_272”
OpenJDK Runtime Environment (build 1.8.0_272-8u272-b10-0ubuntu1~18.04-b10)
OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)

@kdaud From your Maven output:

Java version: 13.0.2, vendor: Oracle Corporation, runtime: /usr/lib/jvm/jdk-13.0.2

So Maven is (somehow) picking up an install of JDK 13… Could you include the output of these commands:

which java

Try to switch your jdk to openjdk verion “1.8.0_261”.

  1. Download and install jdk-8u261-linux-x64.tar.gz (if you are using linux 64 bit).
  2. Switch the jdk sudo update-alternatives --config java.
  3. Select the 1.8.0_261.
  4. Try mvn clean install

Looking at this,it simply means you have two java setups in your environment variables,try pointing to only java 8 @kdaud

:smile: :smiley: Switching the jdk to 1.8 version resolves the conflict. Though its resolved, what is behind the seen when jdk-13 version is installed. Is there something like incompatibility with the module regarding jdk versions. Some insight on this!
cc: @ibacher, @dkayiwa

a few things to note here, it looks like jdk 13 doesn’t run well with maven 3.6.3 (note: i have not tested this but basing on your submission here, that can be among some of the conclusions or you might have missed out some thing on setting up the environment variables for java 13) :relaxed:

It’s to do with backwards compatibility. Because the REST API is designed to be compatible with very old versions of OpenMRS we compile it so that it can be run on Java 6. Support for compiling to Java 6 seems to have been dropped in either Java 12 or 13.

1 Like

I get it!. Thanks @ibacher for the insight. Any way do we have a road in the pipeline of upgrading the module to support Java 9 and above ?