Skip to content

Commit acb90ae

Browse files
authored
Merge pull request #479 from yidongnan/docs/getting-started
Improve server getting-started docs
2 parents 2ee90f1 + 1b78410 commit acb90ae

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

docs/en/server/getting-started.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,29 @@ We recommend splitting your project into 2-3 separate modules.
4545
#### Maven (Interface)
4646

4747
````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+
4854
<dependencies>
4955
<dependency>
5056
<groupId>io.grpc</groupId>
5157
<artifactId>grpc-stub</artifactId>
58+
<version>${grpc.version}</version>
5259
</dependency>
5360
<dependency>
5461
<groupId>io.grpc</groupId>
5562
<artifactId>grpc-protobuf</artifactId>
63+
<version>${grpc.version}</version>
5664
</dependency>
5765
<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>
6171
</dependency>
6272
</dependencies>
6373

@@ -66,13 +76,15 @@ We recommend splitting your project into 2-3 separate modules.
6676
<extension>
6777
<groupId>kr.motd.maven</groupId>
6878
<artifactId>os-maven-plugin</artifactId>
79+
<version>1.6.2</version>
6980
</extension>
7081
</extensions>
7182

7283
<plugins>
7384
<plugin>
7485
<groupId>org.xolstice.maven.plugins</groupId>
7586
<artifactId>protobuf-maven-plugin</artifactId>
87+
<version>${protobuf-plugin.version}</version>
7688
<configuration>
7789
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
7890
<pluginId>grpc-java</pluginId>
@@ -94,11 +106,27 @@ We recommend splitting your project into 2-3 separate modules.
94106
#### Gradle (Interface)
95107

96108
````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+
}
98125
99126
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
102130
}
103131
104132
protobuf {
@@ -111,7 +139,7 @@ protobuf {
111139
}
112140
plugins {
113141
grpc {
114-
artifact = "io.grpc:protoc-gen-grpc-java"
142+
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
115143
}
116144
}
117145
generateProtoTasks {
@@ -121,12 +149,6 @@ protobuf {
121149
}
122150
}
123151
124-
buildscript {
125-
dependencies {
126-
classpath "com.google.protobuf:protobuf-gradle-plugin:${protobufGradlePluginVersion}"
127-
}
128-
}
129-
130152
// Optional
131153
eclipse {
132154
classpath {

0 commit comments

Comments
 (0)