【问题标题】:How to include a pkcs12 binary file in a Spring Boot tar file如何在 Spring Boot tar 文件中包含 pkcs12 二进制文件
【发布时间】:2018-08-29 14:00:02
【问题描述】:

我需要在我的 Spring Boot 微服务发行版中包含一个二进制 pkcs12 证书文件。我尝试将它添加到根目录和 src/main/resources 中,但由于它不是文本文件,Gradle 返回错误“无法复制文件”(Gradle 指定为什么他不能复制它顺便说一句,那就太好了)

如何包含该资源,以便在执行 Gradle distTar 时文件包含在项目中,以便内置 Tomcat 找到它并正确配置 https 协议?

【问题讨论】:

标签: spring-boot gradle


【解决方案1】:

我终于解决了:

processResources {
  // Exclude the certs files to be processed as text
  exclude "**/*.pkcs12"

  // Copy the pkcs12 files to the resources (classpath)
  doLast {
    copy {
      from "src/main/resources/tripbruKeystoreWithKey.pkcs12"
      into "$buildDir/resources/main/"
    }
  }
}

这使得 pkcs12 文件与其余资源一起结束。现在我需要找出如何从属性列表中引用,bu

【讨论】:

    猜你喜欢
    • 2017-03-16
    • 2018-06-11
    • 1970-01-01
    • 1970-01-01
    • 2016-06-07
    • 1970-01-01
    • 2014-08-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多