【问题标题】:How to create a start script for the example gRPC Java TLS server/client?如何为示例 gRPC Java TLS 服务器/客户端创建启动脚本?
【发布时间】:2021-01-19 05:41:52
【问题描述】:

我正在尝试遵循 grpc-java 的 TLS 示例 https://github.com/grpc/grpc-java/tree/master/examples/example-tls 的 README.md。它表明正在运行

../gradlew installDist

这会在运行示例的build/install/example-tls/bin/ 目录中创建脚本hello-world-tls-serverhello-world-tls-client。该示例要求服务器在启动客户端之前运行。

但是,在 examples 目录中的所有位置将 gRPC 版本 1.36.0-SNAPSHOT 替换为 1.35.0 并运行该命令后,build/install/examples/bin 目录不包含此类脚本:

~/D/S/g/examples (master)> tree build/install/examples/bin
build/install/examples/bin
├── compressing-hello-world-client
├── compressing-hello-world-client.bat
├── hedging-hello-world-client
├── hedging-hello-world-client.bat
├── hedging-hello-world-server
├── hedging-hello-world-server.bat
├── hello-world-client
├── hello-world-client.bat
├── hello-world-server
├── hello-world-server.bat
├── retrying-hello-world-client
├── retrying-hello-world-client.bat
├── retrying-hello-world-server
├── retrying-hello-world-server.bat
├── route-guide-client
├── route-guide-client.bat
├── route-guide-server
└── route-guide-server.bat

0 directories, 18 files

在我的本地存储库中,我已将这一行 https://github.com/grpc/grpc-java/blob/1b23cf4f39ab26728336edbda8bb6af22dfe0a01/examples/example-tls/build.gradle#L58 更改为

startScripts.enabled = true

但是,再次运行./gradlew installDist 后,仍然找不到预期的启动脚本。我仔细阅读了CreateStartScriptshttps://docs.gradle.org/current/dsl/org.gradle.jvm.application.tasks.CreateStartScripts.html 上的文档,但我并没有立即看出有什么问题。知道为什么没有为 TLS 示例创建启动脚本吗?

【问题讨论】:

    标签: gradle grpc-java


    【解决方案1】:

    查看 git 标签的文档recommends

    强烈建议您查看 git 发布标签,因为已经有可用的 grpc 构建

    ❯ git checkout v1.35.0
    ❯ cd examples/example-tls
    ❯ ../gradlew installDist
    

    然后您就可以在build/install/example-tls/bin 中找到二进制文件:

    ❯ tree build/install/example-tls/bin
    build/install/example-tls/bin
    ├── hello-world-tls-client
    ├── hello-world-tls-client.bat
    ├── hello-world-tls-server
    └── hello-world-tls-server.bat
    

    【讨论】:

      猜你喜欢
      • 2021-10-21
      • 2020-09-09
      • 1970-01-01
      • 2018-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-03
      • 2020-08-17
      相关资源
      最近更新 更多