/aws-sam-gradle-plugin

:shipit: Gradle plugin to bind aws-sam-cli

Primary LanguageKotlinMIT LicenseMIT

AWS SAM Gradle Plugin

importre.gradle

Gradle plugin to bind aws-sam-cli

Prerequisites

Usage

build.gradle.kts
plugins {
    id("aws.sam") version "$version"     // (1)
}

sam {
    bucket = "your_bucket_name"          // (2)
    stack = "your_stack_name"            // (3)
    template = file("your_template.yml") // (4)
}
  1. See latest version

  2. AWS S3 Bucket Name

  3. AWS CloudFormation Stack Name

  4. template.yml for SAM

And then, run a task you want

Tasks

  • runs sam local start-api

  • depends on clean and build

  • runs sam package

  • depends on clean, build and makeBucket

  • runs sam deploy

  • depends on packageSamApp

build

  • finalized by shadowJar task

    • Check the fat jar ($buildDir/libs/${project.name}-all.jar)

If you’d like to minimize jar, use tasks.shadowJar.minimize

build.gradle.kts example
tasks {
    shadowJar {
        minimize {
            exclude(dependency("joda-time:.*:.*"))
        }
    }
}

References