Encourage using grpc-netty-shaded instead of grpc-netty

grpc-netty is still really useful, but for most users who aren't doing
anything advanced using grpc-netty-shaded is much safer from a
dependency basis.

grpc-netty-shaded has seen more usage and has shown itself to be stable
and reduce the number of conflicts due to Netty versions.
This commit is contained in:
Eric Anderson 2018-08-02 16:00:12 -07:00
parent 478f006d3e
commit b64cde1488
7 changed files with 10 additions and 9 deletions

View File

@ -30,7 +30,7 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
```xml ```xml
<dependency> <dependency>
<groupId>io.grpc</groupId> <groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId> <artifactId>grpc-netty-shaded</artifactId>
<version>1.14.0</version> <version>1.14.0</version>
</dependency> </dependency>
<dependency> <dependency>
@ -47,12 +47,12 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
Or for Gradle with non-Android, add to your dependencies: Or for Gradle with non-Android, add to your dependencies:
```gradle ```gradle
compile 'io.grpc:grpc-netty:1.14.0' compile 'io.grpc:grpc-netty-shaded:1.14.0'
compile 'io.grpc:grpc-protobuf:1.14.0' compile 'io.grpc:grpc-protobuf:1.14.0'
compile 'io.grpc:grpc-stub:1.14.0' compile 'io.grpc:grpc-stub:1.14.0'
``` ```
For Android client, use `grpc-okhttp` instead of `grpc-netty` and For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
`grpc-protobuf-lite` or `grpc-protobuf-nano` instead of `grpc-protobuf`: `grpc-protobuf-lite` or `grpc-protobuf-nano` instead of `grpc-protobuf`:
```gradle ```gradle
compile 'io.grpc:grpc-okhttp:1.14.0' compile 'io.grpc:grpc-okhttp:1.14.0'

View File

@ -58,7 +58,8 @@ public abstract class ManagedChannelProvider {
public static ManagedChannelProvider provider() { public static ManagedChannelProvider provider() {
if (provider == null) { if (provider == null) {
throw new ProviderNotFoundException("No functional channel service provider found. " throw new ProviderNotFoundException("No functional channel service provider found. "
+ "Try adding a dependency on the grpc-okhttp or grpc-netty artifact"); + "Try adding a dependency on the grpc-okhttp, grpc-netty, or grpc-netty-shaded "
+ "artifact");
} }
return provider; return provider;
} }

View File

@ -53,7 +53,7 @@ public abstract class ServerProvider {
public static ServerProvider provider() { public static ServerProvider provider() {
if (provider == null) { if (provider == null) {
throw new ProviderNotFoundException("No functional server found. " throw new ProviderNotFoundException("No functional server found. "
+ "Try adding a dependency on the grpc-netty artifact"); + "Try adding a dependency on the grpc-netty or grpc-netty-shaded artifact");
} }
return provider; return provider;
} }

View File

@ -23,7 +23,7 @@ need to make the following changes:
+++ b/examples/build.gradle +++ b/examples/build.gradle
@@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
dependencies { dependencies {
compile "io.grpc:grpc-netty:${grpcVersion}" compile "io.grpc:grpc-netty-shaded:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}" compile "io.grpc:grpc-protobuf:${grpcVersion}"
+ compile "io.grpc:grpc-services:${grpcVersion}" + compile "io.grpc:grpc-services:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}" compile "io.grpc:grpc-stub:${grpcVersion}"

View File

@ -30,7 +30,7 @@ def protocVersion = '3.5.1-1'
dependencies { dependencies {
compile "com.google.api.grpc:proto-google-common-protos:1.0.0" compile "com.google.api.grpc:proto-google-common-protos:1.0.0"
compile "io.grpc:grpc-alts:${grpcVersion}" compile "io.grpc:grpc-alts:${grpcVersion}"
compile "io.grpc:grpc-netty:${grpcVersion}" compile "io.grpc:grpc-netty-shaded:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}" compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}" compile "io.grpc:grpc-stub:${grpcVersion}"
compileOnly "javax.annotation:javax.annotation-api:1.2" compileOnly "javax.annotation:javax.annotation-api:1.2"

View File

@ -40,7 +40,7 @@ def grpcVersion = '1.15.0-SNAPSHOT' // CURRENT_GRPC_VERSION
dependencies { dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile "com.google.api.grpc:proto-google-common-protos:1.0.0" compile "com.google.api.grpc:proto-google-common-protos:1.0.0"
compile "io.grpc:grpc-netty:${grpcVersion}" compile "io.grpc:grpc-netty-shaded:${grpcVersion}"
compile "io.grpc:grpc-protobuf:${grpcVersion}" compile "io.grpc:grpc-protobuf:${grpcVersion}"
compile "io.grpc:grpc-stub:${grpcVersion}" compile "io.grpc:grpc-stub:${grpcVersion}"

View File

@ -22,7 +22,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>io.grpc</groupId> <groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId> <artifactId>grpc-netty-shaded</artifactId>
<version>${grpc.version}</version> <version>${grpc.version}</version>
</dependency> </dependency>
<dependency> <dependency>