Skip to content

Commit bdac6d6

Browse files
committed
Improve server getting-started docs (Fixes #478)
1 parent f6f3b05 commit bdac6d6

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

docs/en/server/getting-started.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,28 @@ We recommend splitting your project into 2-3 separate modules.
4444
#### Maven (Interface)
4545

4646
````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+
4753
<dependencies>
4854
<dependency>
4955
<groupId>io.grpc</groupId>
5056
<artifactId>grpc-stub</artifactId>
57+
<version>${grpc.version}</version>
5158
</dependency>
5259
<dependency>
5360
<groupId>io.grpc</groupId>
5461
<artifactId>grpc-protobuf</artifactId>
62+
<version>${grpc.version}</version>
5563
</dependency>
5664
<dependency>
5765
<!-- Java 9+ compatibility -->
5866
<groupId>javax.annotation</groupId>
5967
<artifactId>javax.annotation-api</artifactId>
68+
<version>2.0.0</version>
6069
</dependency>
6170
</dependencies>
6271

@@ -65,13 +74,15 @@ We recommend splitting your project into 2-3 separate modules.
6574
<extension>
6675
<groupId>kr.motd.maven</groupId>
6776
<artifactId>os-maven-plugin</artifactId>
77+
<version>1.6.2</version>
6878
</extension>
6979
</extensions>
7080

7181
<plugins>
7282
<plugin>
7383
<groupId>org.xolstice.maven.plugins</groupId>
7484
<artifactId>protobuf-maven-plugin</artifactId>
85+
<version>${protobuf-plugin.version}</version>
7586
<configuration>
7687
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
7788
<pluginId>grpc-java</pluginId>
@@ -93,11 +104,27 @@ We recommend splitting your project into 2-3 separate modules.
93104
#### Gradle (Interface)
94105

95106
````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+
}
97123
98124
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
101128
}
102129
103130
protobuf {
@@ -110,7 +137,7 @@ protobuf {
110137
}
111138
plugins {
112139
grpc {
113-
artifact = "io.grpc:protoc-gen-grpc-java"
140+
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
114141
}
115142
}
116143
generateProtoTasks {
@@ -120,12 +147,6 @@ protobuf {
120147
}
121148
}
122149
123-
buildscript {
124-
dependencies {
125-
classpath "com.google.protobuf:protobuf-gradle-plugin:${protobufGradlePluginVersion}"
126-
}
127-
}
128-
129150
// Optional
130151
eclipse {
131152
classpath {

0 commit comments

Comments
 (0)