Table of Contents
Gradle plugin to bind aws-sam-cli
-
Gradle 5.3 ⬆️
-
Python (for
awscli
,aws-sam-cli
) -
aws configure
(for deployment) -
Docker (for local development)
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)
}
-
See latest version
-
AWS S3 Bucket Name
-
AWS CloudFormation Stack Name
-
template.yml
for SAM
And then, run a task you want
-
runs
sam local start-api
-
depends on
clean
andbuild
-
runs
sam package
-
depends on
clean
,build
andmakeBucket
-
runs
sam deploy
-
depends on
packageSamApp
-
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:.*:.*"))
}
}
}