@@ -44,19 +44,28 @@ We recommend splitting your project into 2-3 separate modules.
44
44
#### Maven (Interface)
45
45
46
46
```` xml
47
+ <properties >
48
+ <protobuf .version>3.14.0</protobuf .version>
49
+ <protobuf-plugin .version>0.6.1</protobuf-plugin .version>
50
+ <grpc .version>1.35.0</grpc .version>
51
+ </properties >
52
+
47
53
<dependencies >
48
54
<dependency >
49
55
<groupId >io.grpc</groupId >
50
56
<artifactId >grpc-stub</artifactId >
57
+ <version >${grpc.version}</version >
51
58
</dependency >
52
59
<dependency >
53
60
<groupId >io.grpc</groupId >
54
61
<artifactId >grpc-protobuf</artifactId >
62
+ <version >${grpc.version}</version >
55
63
</dependency >
56
64
<dependency >
57
65
<!-- Java 9+ compatibility -->
58
66
<groupId >javax.annotation</groupId >
59
67
<artifactId >javax.annotation-api</artifactId >
68
+ <version >2.0.0</version >
60
69
</dependency >
61
70
</dependencies >
62
71
@@ -65,13 +74,15 @@ We recommend splitting your project into 2-3 separate modules.
65
74
<extension >
66
75
<groupId >kr.motd.maven</groupId >
67
76
<artifactId >os-maven-plugin</artifactId >
77
+ <version >1.6.2</version >
68
78
</extension >
69
79
</extensions >
70
80
71
81
<plugins >
72
82
<plugin >
73
83
<groupId >org.xolstice.maven.plugins</groupId >
74
84
<artifactId >protobuf-maven-plugin</artifactId >
85
+ <version >${protobuf-plugin.version}</version >
75
86
<configuration >
76
87
<protocArtifact >com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact >
77
88
<pluginId >grpc-java</pluginId >
@@ -93,11 +104,27 @@ We recommend splitting your project into 2-3 separate modules.
93
104
#### Gradle (Interface)
94
105
95
106
```` gradle
96
- apply plugin: 'com.google.protobuf'
107
+ buildscript {
108
+ ext {
109
+ protobufVersion = '3.14.0'
110
+ protobufPluginVersion = '0.8.14'
111
+ grpcVersion = '1.35.0'
112
+ }
113
+ }
114
+
115
+ plugins {
116
+ id 'java-library'
117
+ id 'com.google.protobuf' version "${protobufPluginVersion}"
118
+ }
119
+
120
+ repositories {
121
+ mavenCentral()
122
+ }
97
123
98
124
dependencies {
99
- compile "io.grpc:grpc-protobuf"
100
- compile "io.grpc:grpc-stub"
125
+ implementation "io.grpc:grpc-protobuf:${grpcVersion}"
126
+ implementation "io.grpc:grpc-stub:${grpcVersion}"
127
+ implementation 'jakarta.annotation:jakarta.annotation-api:2.0.0' // Java 9+ compatibility
101
128
}
102
129
103
130
protobuf {
@@ -110,7 +137,7 @@ protobuf {
110
137
}
111
138
plugins {
112
139
grpc {
113
- artifact = "io.grpc:protoc-gen-grpc-java"
140
+ artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion} "
114
141
}
115
142
}
116
143
generateProtoTasks {
@@ -120,12 +147,6 @@ protobuf {
120
147
}
121
148
}
122
149
123
- buildscript {
124
- dependencies {
125
- classpath "com.google.protobuf:protobuf-gradle-plugin:${protobufGradlePluginVersion}"
126
- }
127
- }
128
-
129
150
// Optional
130
151
eclipse {
131
152
classpath {
0 commit comments