Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Migrate to Java 17
Browse files Browse the repository at this point in the history
- No production code changes
- Fix to an unreliable test
- pom.xml changes for maven compiler plugin

Signed-off-by: Roy Golan <[email protected]>
  • Loading branch information
rgolangh authored and openshift-merge-robot committed Apr 17, 2023
1 parent 0fe50ae commit 7a3dfa1
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 34 deletions.
44 changes: 20 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ TESTDBUSER := parodos
TESTDBPORT := 5432

# maven
MAVEN ?= mvn
MAVEN ?= /usr/bin/mvn

# set quiet mode by default
Q=@

ORG=quay.io/parodos/
WORKFLOW_SERVICE_IMAGE=workflow-service
Expand All @@ -23,36 +22,32 @@ VERSION = $(shell sed -n "s/<revision>\(.*\)<\/revision>/\1/p" $(PWD)/pom.xml |
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed s,^main$$,latest,g)
GIT_HASH := $(shell git rev-parse HEAD)

JAVA_VERSION_MAX_SUPPORTED=11
JAVA_VERSION_MIN_SUPPORTED=11
MVN_JAVA_VERSION := $(shell $(MAVEN) --version | awk 'NR==3 { split($$3, ver, "."); print ver[1] }')
JAVA_VERSION := $(shell java --version | awk 'NR==1 { split($$2, ver, "."); print ver[1] }')
JAVA_VERSION_MAX_SUPPORTED=17
JAVA_VERSION_MIN_SUPPORTED=17

# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

mvn-checks:
# check if maven is installed
ifeq (,$(shell which $(MAVEN)))
$(error "No maven found in $(PATH). Please install maven")
else
MVN_JAVA_VERSION=$(shell mvn --version | sed -rn "s/.*Java version: ([[:digit:]]+)\.[[:digit:]]+\.[[:digit:]]+.*/\1/p")
MVN_VERSION_IS_SUPPORTED=$(shell [ $(MVN_JAVA_VERSION) -le $(JAVA_VERSION_MAX_SUPPORTED) ] && [ $(MVN_JAVA_VERSION) -ge $(JAVA_VERSION_MIN_SUPPORTED) ] && echo true)
ifeq ($(MVN_VERSION_IS_SUPPORTED), )
$(error "Maven Java $(MVN_JAVA_VERSION) version should be [$(JAVA_VERSION_MIN_SUPPORTED) ; $(JAVA_VERSION_MAX_SUPPORTED)]. Please use Java within these bounds with mvn")
endif
endif
# check if maven is installed
@if [ -z $(MVN_JAVA_VERSION) ]; then echo "No maven found in $(PATH). Please install maven"; exit 1; fi
@if [ $(MVN_JAVA_VERSION) -lt $(JAVA_VERSION_MIN_SUPPORTED) ] || [ $(MVN_JAVA_VERSION) -gt $(JAVA_VERSION_MIN_SUPPORTED) ]; then \
echo "Maven Java $(MVN_JAVA_VERSION) version should be [$(JAVA_VERSION_MIN_SUPPORTED) ; $(JAVA_VERSION_MAX_SUPPORTED)]. Please use Java within these bounds with mvn"; \
exit 1; \
fi

java-checks:
# check java version
ifeq (,$(shell java --version))
$(error "No java found in $(PATH). Please install java >= 11")
else
JAVA_VERSION=$(shell java --version | head -n 1 | sed -rn "s/.*\s([[:digit:]]+)\.[[:digit:]]+\.[[:digit:]]+\s.*/\1/p")
JAVA_VERSION_IS_SUPPORTED=$(shell [ $(JAVA_VERSION) -le $(JAVA_VERSION_MAX_SUPPORTED) ] && [ $(JAVA_VERSION) -ge $(JAVA_VERSION_MIN_SUPPORTED) ] && echo true)
ifeq ($(JAVA_VERSION_IS_SUPPORTED), )
$(error "Java version $(JAVA_VERSION) should be [$(JAVA_VERSION_MIN_SUPPORTED) ; $(JAVA_VERSION_MAX_SUPPORTED)]. Please install Java within those bounds")
endif
endif
# check if Java is installed
@if [ -z $(JAVA_VERSION) ]; then echo "No java found in $(PATH). Please install java >= $(JAVA_VERSION_MIN_SUPPORTED)"; exit 1; fi
@if [ $(JAVA_VERSION) -lt $(JAVA_VERSION_MIN_SUPPORTED) ] || [ $(JAVA_VERSION) -gt $(JAVA_VERSION_MAX_SUPPORTED) ]; then \
echo "Java version $(JAVA_VERSION) should be [$(JAVA_VERSION_MIN_SUPPORTED) ; $(JAVA_VERSION_MAX_SUPPORTED)]. Please install Java within those bounds"; \
exit 1; \
fi

##@ General

Expand Down Expand Up @@ -203,3 +198,4 @@ run-postgres: # Run a sample postgres instance

stop-postgres:
$(DOCKER) rm -f parodos-postgres

2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The following are the requirements to run the Parodos services.
| nvm | For installing different tools | Please refer to the implemenation-examples/backstage folder | https://backstage.io/docs/getting-started/configuration |
| yarn | For starting Backstage | Please refer to the implemenation-examples/backstage folder | |
| Keycloak | All Parodos services integrate with it, it in turn can be integrated with different OAuth providers | 17.0+ |
| JDK | Required running the Parodos API | JDK/JVM 11 | At present JVM 11 seems to be the highest version of Java the clients running Parodos are approved to use. This can be updated on demand |
| JDK | Required running the Parodos API | JDK/JVM 17 | At present JVM 17 seems to be the highest version of Java the clients running Parodos are approved to use. This can be updated on demand |
| Spring Boot | All of Parodos serivces (API, Standalone) are built with Spring Boot | 2.5.5 | This is only relevant for those looking change the Parodos code |
| React | All of the Parodos services are written in React | 17.02 | The applications makes use of the Context for State and is styled with Material UI 4.12.4 |
| Database (API layer) | Persistence API layer | Postgres 11.18+ | APIs use JPA and Liquid base to generate schemas. In theory they should work with most popular Database by changing the driver and recompiling the code. When starting any Parodos API in the 'local' profile, an H2 database is configured for evaluations |
Expand Down
5 changes: 0 additions & 5 deletions external-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@

<artifactId>external-dependencies</artifactId>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion notification-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/openjdk-11-runtime
FROM registry.access.redhat.com/ubi9/openjdk-17-runtime

WORKDIR /app

Expand Down
1 change: 0 additions & 1 deletion notification-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<url>http://github.com/parodos-dev/parodos/tree/main</url>
</scm>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2020.0.6</spring-cloud.version>
<springdoc-openapi-ui.version>1.6.4</springdoc-openapi-ui.version>
<openapi.generator.version>5.4.0</openapi.generator.version>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<properties>
<revision>1.0.8-SNAPSHOT</revision>
<flatten.version>1.3.0</flatten.version>
<java.version>11</java.version>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.plugins.compiler.version>3.8.1</maven.plugins.compiler.version>
<maven.plugins.release.version>2.5.3</maven.plugins.release.version>
Expand Down
2 changes: 1 addition & 1 deletion workflow-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.access.redhat.com/ubi9/openjdk-11-runtime
FROM registry.access.redhat.com/ubi9/openjdk-17-runtime

WORKDIR /app

Expand Down

0 comments on commit 7a3dfa1

Please sign in to comment.