Spring Boot and ebextensions

后端 未结 5 1346
走了就别回头了
走了就别回头了 2021-02-20 11:54

I\'m trying to add an .ebextensions folder to the root level of my jar to be deployed to AWS elastic beanstalk.

My folder structure is:

main:
--src
--re         


        
5条回答
  •  南旧
    南旧 (楼主)
    2021-02-20 12:18

    For those of you using Gradle, here is what needs to be added to your build.gradle in order to add the .ebextensions stuff to the root of the jar.

    It assumes that the .ebextensions directory and contents are in the root of your project.

    Normal Java app:

    jar {
        from(".") {
            include ".ebextensions/**"
        }
    }
    

    Spring Boot app:

    bootJar {
        from(".") {
            include ".ebextensions/**"
        }
    }
    

    The Spring Boot case is slightly different to the normal Java case because with Spring Boot it is the Spring Boot Gradle plugin that actually constructs the jar - and it uses a special "bootJar" task in place of the standard Java plugin "jar" task.

    I think that for Maven builds, Javier's answer is the cleanest way to go. For me, this illustrates the flexibility of Gradle over Maven when modifying "standard" builds.

提交回复
热议问题