-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
88 lines (73 loc) · 1.93 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
plugins {
id 'java'
id 'com.google.protobuf' version '0.9.4' // Aktuelle Protobuf-Version
id 'application'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
application {
mainClass = 'com.onlineshop.grpc.WarehouseServer'
}
group 'com.onlineshop'
version '1.0-SNAPSHOT'
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
repositories {
mavenCentral()
}
dependencies {
implementation "io.grpc:grpc-netty:1.57.2"
implementation "io.grpc:grpc-protobuf:1.57.2"
implementation "io.grpc:grpc-stub:1.57.2"
implementation "com.google.protobuf:protobuf-java:4.29.3"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
}
// gRPC und Protobuf Konfiguration
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:4.29.3" // Die richtige Protoc-Version
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:1.57.2"
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
tasks.withType(com.google.protobuf.gradle.GenerateProtoTask) {
plugins {
grpc {}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
shadowJar {
archiveFileName = 'warehouse-service-all.jar'
manifest {
attributes 'Main-Class': 'com.onlineshop.grpc.WarehouseServer'
}
}
// Custom task for Subscriber
task runServer(type: JavaExec) {
group = 'application'
description = 'Run the gRPC server'
main = 'com.onlineshop.grpc.WarehouseServer'
classpath = sourceSets.main.runtimeClasspath
}
// Custom task for Publisher
task runClient(type: JavaExec) {
group = 'application'
description = 'Run the gRPC client'
main = 'com.onlineshop.grpc.WarehouseClient'
classpath = sourceSets.main.runtimeClasspath
}
tasks.withType(Test) {
useJUnitPlatform()
}