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