Skip to content

Commit

Permalink
Java 21 (#1256)
Browse files Browse the repository at this point in the history
* update to Java 21

* gradle 8.7

* project naming adjustments

* sonar plugin update

* updated documentation to reference Java 21
  • Loading branch information
adamloup-enquizit authored Apr 2, 2024
1 parent bb0f7e0 commit f1c9718
Show file tree
Hide file tree
Showing 20 changed files with 82 additions and 78 deletions.
4 changes: 2 additions & 2 deletions apps/modernization-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ COPY apps/modernization-ui .

RUN npx react-scripts build

FROM gradle:8-jdk17 AS api-builder
FROM gradle:8-jdk21 AS api-builder

# Copy project configuration
COPY gradle /usr/src/nbs/gradle
Expand All @@ -38,7 +38,7 @@ RUN jar xf apps/modernization-api/build/libs/modernization-api.jar

RUN jdeps --ignore-missing-deps -q \
--recursive \
--multi-release 17 \
--multi-release 21 \
--print-module-deps \
--class-path 'BOOT-INF/lib/*' \
apps/modernization-api/build/libs/modernization-api.jar > deps.info
Expand Down
2 changes: 1 addition & 1 deletion apps/modernization-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Prerequisites

1. Java 17
1. Java 21
2. Node / NPM
3. nbs-mssql, elasticsearch, and nifi docker containers are running. See [CDC Sandbox](../../cdc-sandbox/README.md)

Expand Down
16 changes: 8 additions & 8 deletions apps/modernization-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ dependencies {
implementation(project(':event-schema'))
implementation(project(':authentication'))
implementation(project(':id-generator'))
implementation(project(':libs:web'))
implementation(project(':libs:classic-interaction'))
implementation(project(':web'))
implementation(project(':classic-interaction'))

// feature modules
implementation project(':me-api')
Expand Down Expand Up @@ -86,12 +86,12 @@ testing {
useJUnitJupiter()

dependencies {
implementation project(':testing:support')
implementation project(':testing:identity')
implementation project(':testing:auth')
implementation project(':testing:auth-cucumber')
implementation project(':testing:http-interaction')
implementation project(':testing:classic-interaction-cucumber')
implementation project(':testing-support')
implementation project(':testing-identity')
implementation project(':testing-auth')
implementation project(':testing-auth-cucumber')
implementation project(':testing-http-interaction')
implementation project(':testing-classic-interaction-cucumber')

implementation.bundle(libs.bundles.cucumber)

Expand Down
4 changes: 2 additions & 2 deletions apps/nbs-gateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:8-jdk17 AS builder
FROM gradle:8-jdk21 AS builder

# Copy project configuration
COPY gradle /usr/src/nbs/gradle
Expand All @@ -15,7 +15,7 @@ RUN gradle :nbs-gateway:build -x test --no-daemon
RUN jar xf apps/nbs-gateway/build/libs/nbs-gateway.jar
RUN jdeps --ignore-missing-deps -q \
--recursive \
--multi-release 17 \
--multi-release 21 \
--print-module-deps \
--class-path 'BOOT-INF/lib/*' \
apps/nbs-gateway/build/libs/nbs-gateway.jar > deps.info
Expand Down
4 changes: 2 additions & 2 deletions apps/question-bank/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gradle:8-jdk17 AS builder
FROM gradle:8-jdk21 AS builder

# Copy project configuration
COPY gradle /usr/src/nbs/gradle
Expand All @@ -20,7 +20,7 @@ RUN jar xf apps/question-bank/build/libs/question-bank.jar

RUN jdeps --ignore-missing-deps -q \
--recursive \
--multi-release 17 \
--multi-release 21 \
--print-module-deps \
--class-path 'BOOT-INF/lib/*' \
apps/question-bank/build/libs/question-bank.jar > deps.info
Expand Down
3 changes: 1 addition & 2 deletions apps/question-bank/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Contains REST APIs for managing Question Bank entities.

### Prerequisites

1. Java 17
1. Java 21
2. `nbs-mssql` docker containers. See [CDC Sandbox](../../cdc-sandbox/README.md)

## Tests
Expand Down Expand Up @@ -37,7 +37,6 @@ the [CDC Sandbox](../../cdc-sandbox/README.md),`cdc-sandbox/db`.

The application will listen on port `8095`.


### Debugging

The `bootRun` task is configured to allow remote debugging on port `18095` allowing any Java Debugger to attach without
Expand Down
18 changes: 9 additions & 9 deletions apps/question-bank/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ testing {

implementation.bundle(libs.bundles.cucumber)

implementation project(':testing:support')
implementation project(':testing:identity')
implementation project(':testing:auth')
implementation project(':testing:auth-cucumber')
implementation project(':testing:http-interaction')
implementation project(':testing:classic-interaction-cucumber')
implementation project(':testing-support')
implementation project(':testing-identity')
implementation project(':testing-auth')
implementation project(':testing-auth-cucumber')
implementation project(':testing-http-interaction')
implementation project(':testing-classic-interaction-cucumber')

}

Expand Down Expand Up @@ -96,9 +96,9 @@ dependencies {
implementation project(':accumulation')
implementation project(':audit')
implementation project(':id-generator')
implementation(project(':libs:web'))
implementation(project(':libs:classic-interaction'))
implementation(project(':libs:redirect'))
implementation(project(':web'))
implementation(project(':classic-interaction'))
implementation(project(':redirect'))

// implementation libs.snake.yaml
implementation libs.guava
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {
plugins {
id 'java-library'
id 'jacoco'
id 'org.sonarqube' version '4.4.1.3373'
id 'org.sonarqube' version '5.0.0.4638'
}

version = '1.0.1-SNAPSHOT' // The plugin will assign the root project version to all its subprojects.
Expand All @@ -38,7 +38,7 @@ subprojects {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
languageVersion = JavaLanguageVersion.of(21)
vendor = JvmVendorSpec.ADOPTIUM
}

Expand Down
4 changes: 2 additions & 2 deletions documentation/InstallJava.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
1. Install [Homebrew](./InstallHomebrew.md) if you do not have it already.
1. Install Java
```sh
brew install openjdk@17
brew install openjdk@21
```
1. Update Path to include new Java version
```sh
echo "PATH=\"$(pwd)/homebrew/opt/openjdk@17/bin:"'$PATH'\" >> ~/.zshrc
echo "PATH=\"$(pwd)/homebrew/opt/openjdk@21/bin:"'$PATH'\" >> ~/.zshrc
```
1 change: 0 additions & 1 deletion gradle/sonar.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ sonar {
property "sonar.coverage.jacoco.xmlReportPaths", "$project.rootDir/build/reports/jacoco/codeCoverageReport/codeCoverageReport.xml"
}
}
System.setProperty("sonar.gradle.skipCompile", "true")

// See here for more info: https://docs.gradle.org/6.4-rc-1/samples/sample_jvm_multi_project_with_code_coverage.html
//
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
4 changes: 2 additions & 2 deletions libs/configuration-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ testing {
implementation.bundle(libs.bundles.testcontainers)
implementation.bundle(libs.bundles.cucumber)

implementation project(':testing:support')
implementation project(':testing:database')
implementation project(':testing-support')
implementation project(':testing-database')
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions libs/options-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ testing {
implementation.bundle(libs.bundles.testcontainers)
implementation.bundle(libs.bundles.cucumber)

implementation project(':testing:support')
implementation project(':testing:database')
implementation project(':testing-support')
implementation project(':testing-database')
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions libs/testing/auth-cucumber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ dependencies {
implementation(variantOf(libs.queryDSL.jpa) { classifier("jakarta") })

implementation project(':authentication')
implementation project(':testing:support')
implementation project(':testing:identity')
implementation project(':testing:auth')
implementation project(':testing-support')
implementation project(':testing-identity')
implementation project(':testing-auth')

implementation libs.cucumber.java
}
4 changes: 2 additions & 2 deletions libs/testing/auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ dependencies {


implementation project(':authentication')
implementation project(':testing:support')
implementation project(':testing:identity')
implementation project(':testing-support')
implementation project(':testing-identity')
}
2 changes: 1 addition & 1 deletion libs/testing/classic-interaction-cucumber/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
group = 'gov.cdc.nbs.testing.classic.interaction-cucumber'

dependencies {
implementation project(':testing:support')
implementation project(':testing-support')

// Required for testing multipart form-data from Classic NBS
implementation "commons-fileupload:commons-fileupload:1.5"
Expand Down
6 changes: 3 additions & 3 deletions libs/testing/http-interaction/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ dependencies {
implementation libs.springBoot.web

implementation project(':authentication')
implementation project(':testing:support')
implementation project(':testing:identity')
implementation project(':testing:auth')
implementation project(':testing-support')
implementation project(':testing-identity')
implementation project(':testing-auth')

implementation libs.bundles.jpa
implementation libs.bundles.security
Expand Down
42 changes: 21 additions & 21 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("org.gradle.toolchains.foojay-resolver") version "0.7.0"
id("org.gradle.toolchains.foojay-resolver") version "0.8.0"
}

toolchainManagement {
Expand Down Expand Up @@ -56,33 +56,33 @@ project(':id-generator').projectDir = new File('libs/id-generator')
include ':accumulation'
project(':accumulation').projectDir = new File('libs/accumulation')

include ':libs:web'
project(':libs:web').projectDir = new File('libs/web')
include ':web'
project(':web').projectDir = new File('libs/web')

include ':libs:classic-interaction'
project(':libs:classic-interaction').projectDir = new File('libs/classic-interaction')
include ':classic-interaction'
project(':classic-interaction').projectDir = new File('libs/classic-interaction')

include ':libs:redirect'
project(':libs:redirect').projectDir = new File('libs/redirect')
include ':redirect'
project(':redirect').projectDir = new File('libs/redirect')

// testing libraries
include ':testing:support'
project(':testing:support').projectDir = new File('libs/testing/support')
include ':testing-support'
project(':testing-support').projectDir = new File('libs/testing/support')

include ':testing:identity'
project(':testing:identity').projectDir = new File('libs/testing/identity')
include ':testing-identity'
project(':testing-identity').projectDir = new File('libs/testing/identity')

include ':testing:auth'
project(':testing:auth').projectDir = new File('libs/testing/auth')
include ':testing-auth'
project(':testing-auth').projectDir = new File('libs/testing/auth')

include ':testing:auth-cucumber'
project(':testing:auth-cucumber').projectDir = new File('libs/testing/auth-cucumber')
include ':testing-auth-cucumber'
project(':testing-auth-cucumber').projectDir = new File('libs/testing/auth-cucumber')

include ':testing:classic-interaction-cucumber'
project(':testing:classic-interaction-cucumber').projectDir = new File('libs/testing/classic-interaction-cucumber')
include ':testing-classic-interaction-cucumber'
project(':testing-classic-interaction-cucumber').projectDir = new File('libs/testing/classic-interaction-cucumber')

include ':testing:http-interaction'
project(':testing:http-interaction').projectDir = new File('libs/testing/http-interaction')
include ':testing-http-interaction'
project(':testing-http-interaction').projectDir = new File('libs/testing/http-interaction')

include ':testing:database'
project(':testing:database').projectDir = new File('libs/testing/database')
include ':testing-database'
project(':testing-database').projectDir = new File('libs/testing/database')

0 comments on commit f1c9718

Please sign in to comment.