Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 如何在Spring引导tar文件中包含pkcs12二进制文件_Spring Boot_Gradle - Fatal编程技术网

Spring boot 如何在Spring引导tar文件中包含pkcs12二进制文件

Spring boot 如何在Spring引导tar文件中包含pkcs12二进制文件,spring-boot,gradle,Spring Boot,Gradle,我需要在Spring Boot microservice发行版中包含一个二进制pkcs12证书文件。我曾尝试将其添加到根目录和src/main/resources中,但由于它不是文本文件,Gradle返回一个错误“无法复制文件”(最好Gradle指定他无法复制它的原因) 如何包含该资源,以便在执行Gradle Distar时,该文件包含在项目中,以便内置的Tomcat能够找到该资源,并且正确配置了https协议?我最终通过以下方法解决了该问题: processResources { // E

我需要在Spring Boot microservice发行版中包含一个二进制pkcs12证书文件。我曾尝试将其添加到根目录和src/main/resources中,但由于它不是文本文件,Gradle返回一个错误“无法复制文件”(最好Gradle指定他无法复制它的原因)


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

我最终通过以下方法解决了该问题:

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文件与其他资源一起结束。现在我需要了解如何从属性列表中引用if,bu

您是如何配置分发插件的?默认情况下,dist*任务将获取位于/src/main/dist目录中的资源文件,请参阅: