Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The mission of OpenMRS is to improve health care delivery in resource-constraine

OpenMRS is a Java application which is why you need to install a Java JDK.

If you want to build the master branch you will need a Java JDK of minimum version 8.
If you want to build the master branch you will need a Java JDK of minimum version 21.

#### Maven

Expand Down
9 changes: 4 additions & 5 deletions api/src/main/java/org/openmrs/util/OpenmrsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1070,15 +1070,14 @@ public static String getOpenmrsLogLocation() {
}

/**
* Checks whether the current JVM version is at least Java 8.
* Checks whether the current JVM version is at least Java 21.
*
* @throws APIException if the current JVM version is earlier than Java 8
* @throws APIException if the current JVM version is earlier than Java 21
*/
public static void validateJavaVersion() {
// check whether the current JVM version is at least Java 8
if (System.getProperty("java.version").matches("1\\.[0-7]\\.(.*)")) {
if (System.getProperty("java.version").matches("(1\\..*)|(9|1[0-9]|20)(\\..*)?" )) {
throw new APIException(
"OpenMRS " + OpenmrsConstants.OPENMRS_VERSION_SHORT + " requires Java 8 and above, but is running under " +
"OpenMRS " + OpenmrsConstants.OPENMRS_VERSION_SHORT + " requires Java 21 and above, but is running under " +
System.getProperty("java.version"));
}
}
Expand Down
92 changes: 10 additions & 82 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,16 @@
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockitoVersion}</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.17.7</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.17.7</version>
</dependency>
<!--hamcrest-core is needed to update JUnit 4 transitive dependency on hamcrest-core as explained in
http://hamcrest.org/JavaHamcrest/distributables#upgrading-from-hamcrest-1x and
https://github.com/hamcrest/JavaHamcrest/issues/224#issuecomment-449760045
Expand Down Expand Up @@ -1168,88 +1178,6 @@
</properties>
</profile>

<!-- When using mockito-core:3.12.4 with Java 17, we get the following error.
java.lang.NullPointerException: Cannot read the array length because "this.buf" is null
mockito-core:5.6.0 does not support Java 8.
So this profile is required
-->
<profile>
<id>java17</id>
<activation>
<jdk>17</jdk>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.19.0</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.17.7</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.17.7</version>
</dependency>
</dependencies>
</dependencyManagement>
</profile>

<profile>
<id>java21</id>
<activation>
<jdk>21</jdk>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.19.0</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.17.7</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.17.7</version>
</dependency>
</dependencies>
</dependencyManagement>
</profile>

<profile>
<id>java24</id>
<activation>
<jdk>24</jdk>
</activation>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.19.0</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.17.7</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>1.17.7</version>
</dependency>
</dependencies>
</dependencyManagement>
</profile>
</profiles>

<reporting>
Expand Down
8 changes: 1 addition & 7 deletions startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,7 @@ CATALINA_OPTS="${OMRS_JAVA_MEMORY_OPTS} -DOPENMRS_INSTALLATION_SCRIPT=${OMRS_SER
if [ -n "${OMRS_DEV_DEBUG_PORT-}" ]; then
echo "Enabling debugging on port ${OMRS_DEV_DEBUG_PORT}"

JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}' | awk -F '.' '/.*/ {print $1}')

if [[ "$JAVA_VERSION" -gt "8" ]]; then
CATALINA_OPTS="$CATALINA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:${OMRS_DEV_DEBUG_PORT}"
else
CATALINA_OPTS="$CATALINA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${OMRS_DEV_DEBUG_PORT}"
fi
CATALINA_OPTS="$CATALINA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:${OMRS_DEV_DEBUG_PORT}"
fi

cat > $TOMCAT_SETENV_FILE << EOF
Expand Down
2 changes: 1 addition & 1 deletion test-module/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<properties>
<openmrsPlatformVersion>${project.version}</openmrsPlatformVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<javaCompilerVersion>1.8</javaCompilerVersion>
<javaCompilerVersion>21</javaCompilerVersion>
</properties>

<dependencyManagement>
Expand Down