Skip to content

Commit fd50d8a

Browse files
Update dependencies (#379)
- Update Gradle and Maven build tools in Docker image to latest versions. - Update project dependencies, including fabric-protos, which now requires protobuf-java v4 instead of v3. - Gradle build file modifications to avoid deprecated features. Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com>
1 parent 826f077 commit fd50d8a

File tree

18 files changed

+115
-157
lines changed

18 files changed

+115
-157
lines changed

build.gradle

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66

77
plugins {
8-
id "com.github.ben-manes.versions" version "0.51.0"
9-
id "com.diffplug.spotless" version "6.25.0"
8+
id "com.github.ben-manes.versions" version "0.52.0"
9+
id "com.diffplug.spotless" version "7.0.4"
1010
}
1111

1212
version = '2.5.6'
@@ -28,15 +28,13 @@ allprojects {
2828

2929
repositories {
3030
mavenCentral()
31-
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
32-
maven { url "https://www.jitpack.io" }
3331
}
3432

3533
spotless {
3634
format 'misc', {
3735
target '*.gradle', '.gitattributes', '.gitignore'
3836
trimTrailingWhitespace()
39-
indentWithSpaces()
37+
leadingTabsToSpaces()
4038
endWithNewline()
4139
}
4240
}
@@ -62,14 +60,14 @@ subprojects {
6260

6361
dependencies {
6462
implementation 'commons-cli:commons-cli:1.9.0'
65-
implementation 'commons-logging:commons-logging:1.3.4'
63+
implementation 'commons-logging:commons-logging:1.3.5'
6664

67-
testImplementation platform('org.junit:junit-bom:5.11.3')
65+
testImplementation platform('org.junit:junit-bom:5.13.1')
6866
testImplementation 'org.junit.jupiter:junit-jupiter'
6967
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
70-
testImplementation 'org.assertj:assertj-core:3.26.3'
71-
testImplementation 'org.mockito:mockito-core:5.14.2'
72-
testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.1.7'
68+
testImplementation 'org.assertj:assertj-core:3.27.3'
69+
testImplementation 'org.mockito:mockito-core:5.18.0'
70+
testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.1.8'
7371

7472
testImplementation 'org.hamcrest:hamcrest-library:3.0'
7573
}
@@ -81,7 +79,7 @@ subprojects {
8179
spotless {
8280
java {
8381
removeUnusedImports()
84-
palantirJavaFormat('2.50.0').formatJavadoc(true)
82+
palantirJavaFormat('2.67.0').formatJavadoc(true)
8583
formatAnnotations()
8684
}
8785
}

examples/fabric-contract-example-as-service/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Example multi-stage dockerfile for Java Chaincode
55

66
# the first stage
7-
FROM gradle:jdk11 AS GRADLE_BUILD
7+
FROM gradle:8-jdk21 AS gradle_build
88

99
# copy the build.gradle and src code to the container
1010
COPY src/ src/
@@ -15,11 +15,11 @@ RUN gradle build shadowJar
1515

1616

1717
# the second stage of our build just needs the compiled files
18-
FROM openjdk:11-jre-slim
18+
FROM eclipse-temurin:21-jre
1919
# copy only the artifacts we need from the first stage and discard the rest
20-
COPY --from=GRADLE_BUILD /home/gradle/build/libs/chaincode.jar /chaincode.jar
20+
COPY --from=gradle_build /home/gradle/build/libs/chaincode.jar /chaincode.jar
2121

22-
ENV PORT 9999
22+
ENV PORT=9999
2323
EXPOSE 9999
2424

2525
# set the startup command to execute the jar
Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '8.1.1'
2+
id 'com.gradleup.shadow' version '8.3.6'
33
id 'java'
44
}
55

6-
version '0.0.1'
7-
8-
tasks.compileJava {
9-
options.release.set(11)
10-
}
6+
version = '0.0.1'
117

128
repositories {
139
mavenCentral()
1410
maven {
15-
url "https://www.jitpack.io"
11+
url = "https://www.jitpack.io"
1612
}
17-
maven {
18-
url "https://hyperledger.jfrog.io/hyperledger/fabric-maven"
19-
}
20-
2113
}
2214

2315
dependencies {
24-
compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.2'
25-
compile 'org.json:json:20240303'
26-
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
27-
testImplementation 'org.assertj:assertj-core:3.26.3'
28-
testImplementation 'org.mockito:mockito-core:5.13.0'
16+
implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.5'
17+
implementation 'org.json:json:20250517'
18+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.1'
19+
testImplementation 'org.assertj:assertj-core:3.27.3'
20+
testImplementation 'org.mockito:mockito-core:5.18.0'
21+
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
2922
}
3023

3124
shadowJar {
@@ -39,14 +32,14 @@ shadowJar {
3932
}
4033
}
4134

35+
compileJava {
36+
options.release.set(11)
37+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters"
38+
}
39+
4240
test {
4341
useJUnitPlatform()
4442
testLogging {
45-
events "passed", "skipped", "failed"
43+
events "PASSED", "SKIPPED", "FAILED"
4644
}
4745
}
48-
49-
50-
tasks.withType(JavaCompile) {
51-
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters"
52-
}

examples/fabric-contract-example-gradle-kotlin/build.gradle.kts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ plugins {
1414
version = "0.0.1"
1515

1616
dependencies {
17-
implementation("org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.2")
18-
implementation("org.json:json:20240303")
17+
implementation("org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.5")
18+
implementation("org.json:json:20250517")
1919
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
2020

21-
testImplementation("org.junit.jupiter:junit-jupiter:5.11.0")
21+
testImplementation("org.junit.jupiter:junit-jupiter:5.13.1")
2222
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0")
2323
}
2424

@@ -27,9 +27,6 @@ repositories {
2727
maven {
2828
setUrl("https://jitpack.io")
2929
}
30-
maven {
31-
setUrl("https://hyperledger.jfrog.io/hyperledger/fabric-maven")
32-
}
3330
}
3431

3532
tasks {
Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '8.1.1'
2+
id 'com.gradleup.shadow' version '8.3.6'
33
id 'java'
44
}
55

6-
version '0.0.1'
7-
8-
tasks.compileJava {
9-
options.release.set(11)
10-
}
6+
version = '0.0.1'
117

128
repositories {
139
mavenCentral()
1410
maven {
15-
url "https://www.jitpack.io"
11+
url = "https://www.jitpack.io"
1612
}
17-
maven {
18-
url "https://hyperledger.jfrog.io/hyperledger/fabric-maven"
19-
}
20-
2113
}
2214

2315
dependencies {
24-
compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.2'
25-
compile 'org.json:json:20240303'
26-
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
27-
testImplementation 'org.assertj:assertj-core:3.26.3'
28-
testImplementation 'org.mockito:mockito-core:5.13.0'
16+
compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.5'
17+
compile 'org.json:json:20250517'
18+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.1'
19+
testImplementation 'org.assertj:assertj-core:3.27.3'
20+
testImplementation 'org.mockito:mockito-core:5.18.0'
2921
}
3022

3123
shadowJar {
@@ -39,14 +31,14 @@ shadowJar {
3931
}
4032
}
4133

34+
compileJava {
35+
options.release.set(11)
36+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters"
37+
}
38+
4239
test {
4340
useJUnitPlatform()
4441
testLogging {
45-
events "passed", "skipped", "failed"
42+
events "PASSED", "SKIPPED", "FAILED"
4643
}
4744
}
48-
49-
50-
tasks.withType(JavaCompile) {
51-
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters"
52-
}

examples/fabric-contract-example-maven/pom.xml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
<slf4j.version>1.7.5</slf4j.version>
2020

2121
<!-- Test -->
22-
<junit.jupiter.version>5.3.0-RC1</junit.jupiter.version>
23-
<junit.platform.version>1.3.0-RC1</junit.platform.version>
22+
<junit.jupiter.version>5.13.1</junit.jupiter.version>
23+
<junit.platform.version>1.13.1</junit.platform.version>
2424

2525
</properties>
2626

@@ -29,10 +29,6 @@
2929
<id>jitpack.io</id>
3030
<url>https://www.jitpack.io</url>
3131
</repository>
32-
<repository>
33-
<id>artifactory</id>
34-
<url>https://hyperledger.jfrog.io/hyperledger/fabric-maven</url>
35-
</repository>
3632
</repositories>
3733

3834
<dependencies>
@@ -48,7 +44,7 @@
4844
<dependency>
4945
<groupId>org.hyperledger.fabric</groupId>
5046
<artifactId>fabric-protos</artifactId>
51-
<version>0.3.3</version>
47+
<version>0.3.7</version>
5248
<scope>compile</scope>
5349
</dependency>
5450

@@ -92,7 +88,7 @@
9288
<dependency>
9389
<groupId>org.mockito</groupId>
9490
<artifactId>mockito-core</artifactId>
95-
<version>2.10.0</version>
91+
<version>5.18.0</version>
9692
</dependency>
9793

9894
<!-- https://mvnrepository.com/artifact/org.json/json -->

examples/ledger-api/build.gradle

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,23 @@
11
plugins {
2-
id 'com.github.johnrengelman.shadow' version '8.1.1'
2+
id 'com.gradleup.shadow' version '8.3.6'
33
id 'java'
44
}
55

66
version '0.0.1'
77

8-
tasks.compileJava {
9-
options.release.set(11)
10-
}
11-
128
repositories {
139
mavenCentral()
1410
maven {
1511
url "https://www.jitpack.io"
1612
}
17-
maven {
18-
url "https://hyperledger.jfrog.io/hyperledger/fabric-maven"
19-
}
20-
2113
}
2214

2315
dependencies {
24-
compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.2'
25-
compile 'org.json:json:20240303'
26-
testImplementation 'org.junit.jupiter:junit-jupiter:5.11.0'
27-
testImplementation 'org.assertj:assertj-core:3.26.3'
28-
testImplementation 'org.mockito:mockito-core:5.13.0'
16+
compile 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.5.5'
17+
compile 'org.json:json:20250517'
18+
testImplementation 'org.junit.jupiter:junit-jupiter:5.13.1'
19+
testImplementation 'org.assertj:assertj-core:3.27.3'
20+
testImplementation 'org.mockito:mockito-core:5.18.0'
2921
}
3022

3123
shadowJar {
@@ -39,14 +31,14 @@ shadowJar {
3931
}
4032
}
4133

34+
compileJava {
35+
options.release.set(11)
36+
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters"
37+
}
38+
4239
test {
4340
useJUnitPlatform()
4441
testLogging {
45-
events "passed", "skipped", "failed"
42+
events "PASSED", "SKIPPED", "FAILED"
4643
}
4744
}
48-
49-
50-
tasks.withType(JavaCompile) {
51-
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-parameters"
52-
}

fabric-chaincode-docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ RUN curl -s "https://get.sdkman.io" | bash
1313
SHELL ["/bin/bash", "-c"]
1414

1515
RUN source /root/.sdkman/bin/sdkman-init.sh \
16-
&& sdk install gradle 8.11.1 \
17-
&& sdk install maven 3.9.9
16+
&& sdk install gradle 8.14.2 \
17+
&& sdk install maven 3.9.10
1818

1919
FROM ${JAVA_IMAGE} AS dependencies
2020

0 commit comments

Comments
 (0)