gradlespring-bootebextensions

Clean way of adding .ebextensions to Spring Boot Jar using Gradle


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.

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 ?

Thanks

.. 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')
    }
}

Solution

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

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

    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
    }