From a93ca90d7e07049822da27e76bedaf8c823f23ee Mon Sep 17 00:00:00 2001 From: Kinshuk Bairagi Date: Fri, 12 Jan 2024 16:57:52 +0530 Subject: [PATCH] Support for Java 21 & Gradle 8.5 (#51) --- .github/workflows/java.yml | 11 ++++++----- core/build.gradle | 4 ++-- .../gjex/core/service/AbstractService.java | 2 +- examples/build.gradle | 19 ++++++++++++++++++- gradle/wrapper/gradle-wrapper.properties | 2 +- guice/build.gradle | 2 +- runtime/build.gradle | 2 +- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml index 6945ef4f..a29e188e 100644 --- a/.github/workflows/java.yml +++ b/.github/workflows/java.yml @@ -8,16 +8,17 @@ on: jobs: build: - runs-on: ubuntu-latest - + strategy: + matrix: + version: [8, 17, 21] steps: - uses: actions/checkout@v3 - - name: set up JDK 11 + - name: set up JDK ${{ matrix.version }} uses: actions/setup-java@v3 with: - java-version: '11' - distribution: 'temurin' + java-version: ${{ matrix.version }} + distribution: 'zulu' cache: gradle - name: Grant execute permission for gradlew diff --git a/core/build.gradle b/core/build.gradle index 19d9b8e9..32bee66a 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -57,9 +57,9 @@ dependencies { } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } artifacts { archives sourcesJar -} \ No newline at end of file +} diff --git a/core/src/main/java/com/flipkart/gjex/core/service/AbstractService.java b/core/src/main/java/com/flipkart/gjex/core/service/AbstractService.java index fa90fc25..99e93681 100644 --- a/core/src/main/java/com/flipkart/gjex/core/service/AbstractService.java +++ b/core/src/main/java/com/flipkart/gjex/core/service/AbstractService.java @@ -185,4 +185,4 @@ public void setStopTimeout(long stopTimeout) { this.stopTimeout = stopTimeout; } -} \ No newline at end of file +} diff --git a/examples/build.gradle b/examples/build.gradle index c5812fbd..337112f7 100644 --- a/examples/build.gradle +++ b/examples/build.gradle @@ -21,7 +21,7 @@ repositories { def jexpressVersion = '1.39-SNAPSHOT' def grpcVersion = '1.38.0' def protobufVersion = '3.12.0' -def protocVersion = protobufVersion +def protocVersion = protobufVersion dependencies { implementation "com.flipkart.grpc-jexpress:core:${jexpressVersion}" @@ -74,6 +74,15 @@ task helloWorldServer(type: CreateStartScripts) { classpath = startScripts.classpath } +task runHelloWorldServer(type: JavaExec) { + group = "Execution" + description = "run hello-world-server" + classpath = sourceSets.main.runtimeClasspath + mainClass = 'com.flipkart.gjex.examples.helloworld.HelloWorldApplication' + args "server", "./src/main/resources/hello_world_config.yml" + jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED' +} + task helloWorldClient(type: CreateStartScripts) { mainClassName = 'com.flipkart.gjex.examples.helloworld.client.HelloWorldClient' @@ -82,6 +91,14 @@ task helloWorldClient(type: CreateStartScripts) { classpath = startScripts.classpath } +task runHelloWorldClient(type: JavaExec) { + group = "Execution" + description = "run hello-world-client" + classpath = sourceSets.main.runtimeClasspath + mainClass = 'com.flipkart.gjex.examples.helloworld.client.HelloWorldClient' + jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED' +} + applicationDistribution.into('bin') { from(helloWorldServer) from(helloWorldClient) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a25..a5952066 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/guice/build.gradle b/guice/build.gradle index 10b88538..787bc393 100644 --- a/guice/build.gradle +++ b/guice/build.gradle @@ -60,7 +60,7 @@ dependencies { } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } artifacts { diff --git a/runtime/build.gradle b/runtime/build.gradle index 7777342b..ed1c1328 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -39,7 +39,7 @@ dependencies { } task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' + archiveClassifier = 'sources' from sourceSets.main.allSource } artifacts {