Skip to content

Commit 36926e2

Browse files
Support Java 25
- Update Gradle to 9.1.0. - Update shadow plugin to 9.2.2. - Requires a minimum of Java 17 to run Gradle. - Chaincode and applications still target Java 11. - Use release option instead of Gradle toolchain since the toolchain download can cause issues when building Docker images. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent ad19505 commit 36926e2

56 files changed

Lines changed: 193 additions & 200 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/test-network-setup/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ inputs:
99
default: 20.x
1010
java-version:
1111
description: Version of JDK
12-
default: 11.x
12+
default: 25.x
1313
fabric-version:
1414
description: Version of Hyperledger Fabric
1515
default: 2.5.13

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
env:
1919
GO_VER: "1.23"
2020
NODE_VER: 20.x
21-
JAVA_VER: 11.x
21+
JAVA_VER: 25.x
2222

2323
jobs:
2424
go:

asset-transfer-basic/application-gateway-java/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ dependencies {
2727
implementation 'com.google.code.gson:gson:2.11.0'
2828
}
2929

30-
java {
31-
toolchain {
32-
languageVersion = JavaLanguageVersion.of(11)
33-
}
30+
compileJava {
31+
options.release = 11
3432
}
3533

3634
application {
Binary file not shown.

asset-transfer-basic/application-gateway-java/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

asset-transfer-basic/application-gateway-java/gradlew

Lines changed: 5 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

asset-transfer-basic/application-gateway-java/gradlew.bat

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

asset-transfer-basic/chaincode-java/Dockerfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
# the first stage
2-
FROM gradle:8.6-jdk11 AS GRADLE_BUILD
1+
# the first stage
2+
FROM gradle:9-jdk25 AS gradle_build
33

44
# copy the build.gradle and src code to the container
55
COPY src/ src/
6-
COPY build.gradle ./
6+
COPY build.gradle ./
77

88
# Build and package our code
99
RUN gradle --no-daemon build shadowJar -x checkstyleMain -x checkstyleTest
1010

1111

1212
# the second stage of our build just needs the compiled files
13-
FROM openjdk:11-jre
13+
FROM eclipse-temurin:25-jre
1414
ARG CC_SERVER_PORT=9999
1515

1616
# Setup tini to work better handle signals
17-
ENV TINI_VERSION v0.19.0
17+
ENV TINI_VERSION=v0.19.0
1818
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
1919
RUN chmod +x /tini
2020

2121
RUN addgroup --system javauser && useradd -g javauser javauser
2222

2323
# copy only the artifacts we need from the first stage and discard the rest
24-
COPY --chown=javauser:javauser --from=GRADLE_BUILD /home/gradle/build/libs/chaincode.jar /chaincode.jar
25-
COPY --chown=javauser:javauser docker/docker-entrypoint.sh /docker-entrypoint.sh
24+
COPY --chown=javauser:javauser --from=gradle_build /home/gradle/build/libs/chaincode.jar /chaincode.jar
25+
COPY --chown=javauser:javauser docker/docker-entrypoint.sh /docker-entrypoint.sh
2626

27-
ENV PORT $CC_SERVER_PORT
27+
ENV PORT=$CC_SERVER_PORT
2828
EXPOSE $CC_SERVER_PORT
2929

3030
USER javauser

asset-transfer-basic/chaincode-java/build.gradle

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
plugins {
6-
id 'com.gradleup.shadow' version '8.3.5'
6+
id 'com.gradleup.shadow' version '9.2.2'
77
id 'application'
88
id 'checkstyle'
99
id 'jacoco'
@@ -13,13 +13,14 @@ group 'org.hyperledger.fabric.samples'
1313
version '1.0-SNAPSHOT'
1414

1515
dependencies {
16-
1716
implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.+'
1817
implementation 'org.json:json:+'
1918
implementation 'com.owlike:genson:1.6'
20-
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
21-
testImplementation 'org.assertj:assertj-core:3.25.3'
22-
testImplementation 'org.mockito:mockito-core:5.12.0'
19+
testImplementation platform('org.junit:junit-bom:5.14.0')
20+
testImplementation 'org.junit.jupiter:junit-jupiter'
21+
testImplementation 'org.assertj:assertj-core:3.27.6'
22+
testImplementation 'org.mockito:mockito-core:5.20.0'
23+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2324
}
2425

2526
repositories {
@@ -29,10 +30,8 @@ repositories {
2930
}
3031
}
3132

32-
java {
33-
toolchain {
34-
languageVersion = JavaLanguageVersion.of(11)
35-
}
33+
compileJava {
34+
options.release = 11
3635
}
3736

3837
application {
@@ -75,12 +74,12 @@ test {
7574
}
7675
}
7776

78-
mainClassName = 'org.hyperledger.fabric.contract.ContractRouter'
79-
8077
shadowJar {
8178
archiveBaseName = 'chaincode'
8279
archiveVersion = ''
8380
archiveClassifier = ''
81+
82+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
8483
mergeServiceFiles()
8584

8685
manifest {
Binary file not shown.

0 commit comments

Comments
 (0)