bindableService issue with grpc-java

后端 未结 2 954
故里飘歌
故里飘歌 2021-01-28 06:13

I am trying to use grpc-java v1.1.2 (build.gradle section below) but when I try to run the fat jar for the sample application, its throwing the exception given below. I do not s

2条回答
  •  滥情空心
    2021-01-28 06:46

    I fixed the issue by using the shadow plugin for creating fat jars.

        buildscript {
            repositories {
                mavenCentral()
                mavenLocal()
            }
            dependencies {
                classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.9"
                classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
                classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.0'
            }
        }
    
        plugins {
            id 'java'
            id 'application'
            id 'idea'
            id 'com.github.johnrengelman.shadow' version '1.2.4'
            id "net.ltgt.errorprone" version '0.0.9'
        }
    
    
        shadowJar {
            baseName = 'shadow'
            classifier = null
            version = null
        }
    
    jar {
        manifest {
            attributes(
                    'Class-Path': configurations.runtime.files.collect {"$it.name"}.join(' '),
                    'Main-Class': 'com.abc.test'
            )
        }
    }
    

    Run the following:

    gradle shadowJar
    

    the shadowJar file gets created in the build/libs directory which can be run as:

    java -jar shadowJar
    

提交回复
热议问题