本文介绍了使用Gradle将.ebextensions添加到Spring Boot Jar的干净方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种干净的方法将其他根文件夹添加到使用默认的bootRepackage生成的Spring Boot Jar文件中.就我而言,我需要用于AWS beantalk的.ebextenions文件夹.

Is there a clean way of adding additional root folders to a Spring Boot Jar file generated using the default bootRepackage. In my case I need the .ebextenions folder for AWS beanstalk.

我知道我可以破解它-例如,在bootRepackage之后添加另一个任务以解压缩,重新打包(再次)和重新压缩.有没有更清洁的方法?

I know I can hack it -- for example add another task after bootRepackage to unzip, repackage (again), and re-zip. Is there a cleaner way ?

谢谢

..我尝试过的2种方法(不起作用):

.. the 2 ways that I've tried (that don't work) :

jar {
    from('src/main/ebextensions') {
        into('ebextensions')
    }
}

bootRepackage {
    from('src/main/ebextensions') {
        into('ebextensions')
    }
}

推荐答案

我仍在自己将Spring Boot部署到EBS上...

I'm still working on deploying Spring Boot to EBS myself...

我认为该文件夹必须命名为.ebextensions(注意前导点).所以你会说into('./.ebextensions')而不是into('ebextensions').

I think the folder has to be called .ebextensions (notice the leading dot). So you would say into('./.ebextensions') instead of into('ebextensions').

或者,您可以尝试上传包含JAR和.ebextensions文件夹的ZIP文件:

Alternatively, you might try uploading a ZIP file containing your JAR and your .ebextensions folder:

task zip(type: Zip, dependsOn: bootRepackage) {
    from ('./.ebextensions') {
        into '.ebextensions'
    }
    from (jar.outputs.files) {
        into '.'
    }
    destinationDir project.buildDir
}

这篇关于使用Gradle将.ebextensions添加到Spring Boot Jar的干净方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 07:38