Skip to content

Commit bb44f06

Browse files
committed
Replace deprecated Gradle features
1 parent 2f63061 commit bb44f06

File tree

14 files changed

+160
-62
lines changed

14 files changed

+160
-62
lines changed

microservice-transaction-sample/client/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ dependencies {
1010
}
1111

1212
application {
13-
mainClassName = 'sample.client.Client'
13+
mainClass = 'sample.client.Client'
1414
}
1515

16-
archivesBaseName = "sample-order-service"
16+
base {
17+
archivesName = "sample-order-service"
18+
}
1719

18-
sourceCompatibility = 1.8
19-
targetCompatibility = 1.8
20+
java {
21+
toolchain {
22+
languageVersion = JavaLanguageVersion.of(8)
23+
}
24+
}

microservice-transaction-sample/customer-service/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies {
1414
}
1515

1616
application {
17-
mainClassName = 'sample.customer.CustomerServiceServer'
17+
mainClass = 'sample.customer.CustomerServiceServer'
1818
}
1919

2020
task copyFilesToDockerBuildContextDir(type: Copy) {
@@ -47,7 +47,12 @@ installDist {
4747
duplicatesStrategy DuplicatesStrategy.EXCLUDE
4848
}
4949

50-
archivesBaseName = "sample-customer-service"
50+
base {
51+
archivesName = "sample-customer-service"
52+
}
5153

52-
sourceCompatibility = 1.8
53-
targetCompatibility = 1.8
54+
java {
55+
toolchain {
56+
languageVersion = JavaLanguageVersion.of(8)
57+
}
58+
}

microservice-transaction-sample/order-service/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies {
1414
}
1515

1616
application {
17-
mainClassName = 'sample.order.OrderServiceServer'
17+
mainClass = 'sample.order.OrderServiceServer'
1818
}
1919

2020
task copyFilesToDockerBuildContextDir(type: Copy) {
@@ -47,7 +47,12 @@ installDist {
4747
duplicatesStrategy DuplicatesStrategy.EXCLUDE
4848
}
4949

50-
archivesBaseName = "sample-order-service"
50+
base {
51+
archivesName = "sample-order-service"
52+
}
5153

52-
sourceCompatibility = 1.8
53-
targetCompatibility = 1.8
54+
java {
55+
toolchain {
56+
languageVersion = JavaLanguageVersion.of(8)
57+
}
58+
}

microservice-transaction-sample/rpc/build.gradle

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'java'
33
id 'java-library-distribution'
4-
id 'com.google.protobuf' version '0.9.1'
4+
id 'com.google.protobuf' version '0.9.4'
55
}
66

77
dependencies {
@@ -20,16 +20,40 @@ protobuf {
2020
generateProtoTasks {
2121
all()*.plugins { grpc {} }
2222
}
23-
generatedFilesBaseDir = "$projectDir/src"
2423
}
2524

26-
archivesBaseName = "sample-rpc"
25+
base {
26+
archivesName = "sample-rpc"
27+
}
28+
29+
// Task copyGeneratedProtoToSrc copies the generated .java files into src directory
30+
task copyGeneratedProtoToSrc(type: Copy) {
31+
description 'Copies generated Protocol Buffer classes to src/main/java/sample/rpc'
32+
dependsOn generateProto
33+
from "$buildDir/generated/source/proto/main/java/sample/rpc"
34+
into "$projectDir/src/main/java/sample/rpc"
35+
duplicatesStrategy = DuplicatesStrategy.INCLUDE
36+
}
37+
38+
// Task deleteBuildMainJava deletes the generated .java files in build directory
39+
task deleteBuildMainJava(type: Delete) {
40+
dependsOn copyGeneratedProtoToSrc
41+
delete fileTree(dir: "$buildDir/generated/source/proto/main/java/sample/rpc")
42+
}
2743

2844
// The processResources task needs to depend on the generateProto task because it uses the output
2945
// of the the generateProto task
3046
processResources {
3147
dependsOn generateProto
3248
}
3349

34-
sourceCompatibility = 1.8
35-
targetCompatibility = 1.8
50+
// Task deleteBuildMainJava needs to depend on deleteBuildMainJava to avoid duplicate class error
51+
tasks.named("compileJava").configure {
52+
dependsOn deleteBuildMainJava
53+
}
54+
55+
java {
56+
toolchain {
57+
languageVersion = JavaLanguageVersion.of(8)
58+
}
59+
}

multi-storage-transaction-sample/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ dependencies {
1616
}
1717

1818
application {
19-
mainClassName = 'sample.command.SampleCommand'
19+
mainClass = 'sample.command.SampleCommand'
2020
}
2121

22-
archivesBaseName = "sample"
22+
base {
23+
archivesName = "sample"
24+
}
2325

24-
sourceCompatibility = 1.8
25-
targetCompatibility = 1.8
26+
java {
27+
toolchain {
28+
languageVersion = JavaLanguageVersion.of(8)
29+
}
30+
}

scalardb-kotlin-sample/build.gradle.kts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
4-
kotlin("jvm") version "1.8.21"
4+
kotlin("jvm") version "2.0.21"
55
application
66
}
77

@@ -21,13 +21,8 @@ tasks.test {
2121
useJUnitPlatform()
2222
}
2323

24-
tasks.withType<KotlinCompile> {
25-
kotlinOptions.jvmTarget = "1.8"
26-
}
27-
28-
java {
29-
sourceCompatibility = JavaVersion.VERSION_1_8
30-
targetCompatibility = JavaVersion.VERSION_1_8
24+
kotlin {
25+
jvmToolchain(8)
3126
}
3227

3328
application {

scalardb-sample/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ dependencies {
1616
}
1717

1818
application {
19-
mainClassName = 'sample.command.SampleCommand'
19+
mainClass = 'sample.command.SampleCommand'
2020
}
2121

22-
archivesBaseName = "sample"
22+
base {
23+
archivesName = "sample"
24+
}
2325

24-
sourceCompatibility = 1.8
25-
targetCompatibility = 1.8
26+
java {
27+
toolchain {
28+
languageVersion = JavaLanguageVersion.of(8)
29+
}
30+
}

scalardb-sql-jdbc-sample/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@ dependencies {
1717
}
1818

1919
application {
20-
mainClassName = 'sample.command.SampleCommand'
20+
mainClass = 'sample.command.SampleCommand'
2121
}
2222

23-
archivesBaseName = "sample"
23+
base {
24+
archivesName = "sample"
25+
}
2426

25-
sourceCompatibility = 1.8
26-
targetCompatibility = 1.8
27+
java {
28+
toolchain {
29+
languageVersion = JavaLanguageVersion.of(8)
30+
}
31+
}

spring-data-microservice-transaction-sample/client/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ dependencies {
1010
}
1111

1212
application {
13-
mainClassName = 'sample.client.Client'
13+
mainClass = 'sample.client.Client'
1414
}
1515

16-
archivesBaseName = "sample-order-service"
16+
base {
17+
archivesName = "sample-order-service"
18+
}
1719

18-
sourceCompatibility = 1.8
19-
targetCompatibility = 1.8
20+
java {
21+
toolchain {
22+
languageVersion = JavaLanguageVersion.of(8)
23+
}
24+
}

spring-data-microservice-transaction-sample/customer-service/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies {
1616
}
1717

1818
application {
19-
mainClassName = 'sample.customer.CustomerServiceServer'
19+
mainClass = 'sample.customer.CustomerServiceServer'
2020
}
2121

2222
task copyFilesToDockerBuildContextDir(type: Copy) {
@@ -49,7 +49,12 @@ installDist {
4949
duplicatesStrategy DuplicatesStrategy.EXCLUDE
5050
}
5151

52-
archivesBaseName = "sample-customer-service"
52+
base {
53+
archivesName = "sample-customer-service"
54+
}
5355

54-
sourceCompatibility = 1.8
55-
targetCompatibility = 1.8
56+
java {
57+
toolchain {
58+
languageVersion = JavaLanguageVersion.of(8)
59+
}
60+
}

0 commit comments

Comments
 (0)