diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml
index eb3cc053d..e86f49753 100644
--- a/.github/workflows/pr_build.yml
+++ b/.github/workflows/pr_build.yml
@@ -66,13 +66,17 @@ jobs:
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
+ if: ${{ matrix.java == '8' }} # If 8 exclude the examples directory
+ run: mvn -B install --file pom.xml -pl '!software.amazon.lambda.examples:powertools-examples-idempotency,!software.amazon.lambda.examples:powertools-examples-batch,!software.amazon.lambda.examples:powertools-examples-cloudformation,!software.amazon.lambda.examples:powertools-examples-core-utilities-cdk,!software.amazon.lambda.examples:powertools-examples-core-utilities-sam,!software.amazon.lambda.examples:powertools-examples-core-utilities-serverless,!software.amazon.lambda.examples:powertools-examples-core-utilities-terraform,!software.amazon.lambda.examples:powertools-examples-parameters,!software.amazon.lambda.examples:powertools-examples-serialization,!software.amazon.lambda.examples:powertools-examples-validation,!software.amazon.lambda.examples:cdk,!software.amazon.lambda:powertools-examples'
+ - name: Build with Maven
+ if: ${{ matrix.java != '8' }} # If not 8 don't exclude the examples directory
run: mvn -B install --file pom.xml
- name: Build Gradle Example - Java
- if: ${{ matrix.java == '8' }} # Gradle example can only be built on Java 8
+ if: ${{ matrix.java != '8' }}
working-directory: examples/powertools-examples-core-utilities/gradle
run: ./gradlew build
- name: Build Gradle Example - Kotlin
- if: ${{ matrix.java == '8' }} # Gradle example can only be built on Java 8
+ if: ${{ matrix.java != '8' }}
working-directory: examples/powertools-examples-core-utilities/kotlin
run: ./gradlew build
- name: Setup Terraform
diff --git a/.github/workflows/spotbugs.yml b/.github/workflows/spotbugs.yml
index d314107fa..f0d50d8c5 100644
--- a/.github/workflows/spotbugs.yml
+++ b/.github/workflows/spotbugs.yml
@@ -28,7 +28,7 @@ jobs:
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
with:
distribution: 'corretto'
- java-version: 8
+ java-version: 11
# https://github.com/jwgmeligmeyling/spotbugs-github-action/issues/6
# https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/
# Avoid complexity of git action with publishing report. Just build with spotbugs profile.
diff --git a/examples/README.md b/examples/README.md
index aa8457def..2e34513db 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -63,8 +63,6 @@ If you're not using SAM, you can look for examples for other tools under [powert
You can find more examples in the https://github.com/aws/aws-sam-cli-app-templates project:
-* [Java 8 + Maven](https://github.com/aws/aws-sam-cli-app-templates/tree/master/java8/hello-pt-maven)
-* [Java 8 on Amazon Linux 2 + Maven](https://github.com/aws/aws-sam-cli-app-templates/tree/master/java8.al2/hello-pt-maven)
* [Java 11 + Maven](https://github.com/aws/aws-sam-cli-app-templates/tree/master/java11/hello-pt-maven)
* [Java 17 + Maven](https://github.com/aws/aws-sam-cli-app-templates/tree/master/java17/hello-pt-maven)
* [Java 17 + Gradle](https://github.com/aws/aws-sam-cli-app-templates/tree/master/java17/hello-pt-gradle)
diff --git a/examples/powertools-examples-batch/pom.xml b/examples/powertools-examples-batch/pom.xml
index a5115aeeb..36660bc96 100644
--- a/examples/powertools-examples-batch/pom.xml
+++ b/examples/powertools-examples-batch/pom.xml
@@ -12,8 +12,8 @@
2.20.0
- 1.8
- 1.8
+ 11
+ 11
1.9.20
2.21.1
@@ -143,25 +143,4 @@
-
-
-
-
- jdk8
-
- (,11)
-
-
- 1.9.7
-
-
-
\ No newline at end of file
diff --git a/examples/powertools-examples-cloudformation/README.md b/examples/powertools-examples-cloudformation/README.md
index 4b53ff0aa..f0a15f1cd 100644
--- a/examples/powertools-examples-cloudformation/README.md
+++ b/examples/powertools-examples-cloudformation/README.md
@@ -2,18 +2,27 @@
This project contains an example of Lambda function using the CloudFormation module of Powertools for AWS Lambda in Java. For more information on this module, please refer to the [documentation](https://awslabs.github.io/aws-lambda-powertools-java/utilities/custom_resources/).
+In this example you pass in a bucket name as a parameter and upon CloudFormation events a call is made to a lambda. That lambda attempts to create the bucket on CREATE events, create a new bucket if the name changes with an UPDATE event and delete the bucket upon DELETE events.
+
## Deploy the sample application
This sample can be used either with the Serverless Application Model (SAM) or with CDK.
### Deploy with SAM CLI
To deploy it using the SAM CLI, check out the instructions for getting started in [the examples directory](../README.md)
+Run the following in your shell:
+
+```bash
+cd infra/sam
+sam build
+sam deploy --guided --parameter-overrides BucketNameParam=my-unique-bucket-20230718
+```
### Deploy with CDK
To use CDK you need the following tools.
* CDK - [Install CDK](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html)
-* Java 8 - [Install Java 8](https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html)
+* Java 11 - [Install Java 11](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html)
* Maven - [Install Maven](https://maven.apache.org/install.html)
* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
diff --git a/examples/powertools-examples-cloudformation/pom.xml b/examples/powertools-examples-cloudformation/pom.xml
index d179fbe2e..864ea5fe6 100644
--- a/examples/powertools-examples-cloudformation/pom.xml
+++ b/examples/powertools-examples-cloudformation/pom.xml
@@ -11,8 +11,8 @@
2.20.0
- 1.8
- 1.8
+ 11
+ 11
1.2.3
3.11.3
2.21.0
@@ -169,24 +169,4 @@
-
-
-
- jdk8
-
- (,11)
-
-
- 1.9.7
-
-
-
diff --git a/examples/powertools-examples-core-utilities/cdk/app/pom.xml b/examples/powertools-examples-core-utilities/cdk/app/pom.xml
index be8c9ca67..822e87633 100644
--- a/examples/powertools-examples-core-utilities/cdk/app/pom.xml
+++ b/examples/powertools-examples-core-utilities/cdk/app/pom.xml
@@ -12,8 +12,8 @@
2.20.0
- 1.8
- 1.8
+ 11
+ 11
1.9.20
@@ -138,24 +138,4 @@
-
-
-
- jdk8
-
- (,11)
-
-
- 1.9.7
-
-
-
diff --git a/examples/powertools-examples-core-utilities/cdk/infra/pom.xml b/examples/powertools-examples-core-utilities/cdk/infra/pom.xml
index d2b05b122..053bd239c 100644
--- a/examples/powertools-examples-core-utilities/cdk/infra/pom.xml
+++ b/examples/powertools-examples-core-utilities/cdk/infra/pom.xml
@@ -18,8 +18,8 @@
maven-compiler-plugin
3.11.0
- 1.8
- 1.8
+ 11
+ 11
diff --git a/examples/powertools-examples-core-utilities/gradle/README.md b/examples/powertools-examples-core-utilities/gradle/README.md
index c7c798d5d..adc7fe635 100644
--- a/examples/powertools-examples-core-utilities/gradle/README.md
+++ b/examples/powertools-examples-core-utilities/gradle/README.md
@@ -1,7 +1,7 @@
# Powertools for AWS Lambda (Java) - Core Utilities Example with Gradle
This project demonstrates the Lambda for Powertools Java module deployed using [Serverless Application Model](https://aws.amazon.com/serverless/sam/) with
-[Gradle](https://gradle.org/) running the build. This example is configured for Java 1.8 only; in order to use a newer version, check out the Gradle
+[Gradle](https://gradle.org/) running the build. This example is configured for Java 11 only; in order to use a newer version, check out the Gradle
configuration guide [in the main project README](../../../README.md).
You can also use `sam init` to create a new Gradle-powered Powertools application - choose to use the **AWS Quick Start Templates**,
diff --git a/examples/powertools-examples-core-utilities/gradle/build.gradle b/examples/powertools-examples-core-utilities/gradle/build.gradle
index e85936350..03971c406 100644
--- a/examples/powertools-examples-core-utilities/gradle/build.gradle
+++ b/examples/powertools-examples-core-utilities/gradle/build.gradle
@@ -1,16 +1,16 @@
plugins {
id 'java'
- id "io.freefair.aspectj.post-compile-weaving" version "6.6.3"
+ id "io.freefair.aspectj.post-compile-weaving" version "8.2.2"
}
wrapper {
- gradleVersion = "7.6.1"
+ gradleVersion = "8.5"
}
compileJava {
- sourceCompatibility = "1.8"
- targetCompatibility = "1.8"
+ sourceCompatibility = "11"
+ targetCompatibility = "11"
ajc {
enabled = true
diff --git a/examples/powertools-examples-core-utilities/gradle/gradle/wrapper/gradle-wrapper.properties b/examples/powertools-examples-core-utilities/gradle/gradle/wrapper/gradle-wrapper.properties
index 0d23ac00c..1af9e0930 100644
--- a/examples/powertools-examples-core-utilities/gradle/gradle/wrapper/gradle-wrapper.properties
+++ b/examples/powertools-examples-core-utilities/gradle/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/examples/powertools-examples-core-utilities/gradle/template.yaml b/examples/powertools-examples-core-utilities/gradle/template.yaml
index a717c2998..1a1572fca 100644
--- a/examples/powertools-examples-core-utilities/gradle/template.yaml
+++ b/examples/powertools-examples-core-utilities/gradle/template.yaml
@@ -26,7 +26,7 @@ Resources:
Properties:
CodeUri: .
Handler: helloworld.App::handleRequest
- Runtime: java8
+ Runtime: java11
MemorySize: 512
Environment: # More info about Env Vars: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#environment-object
Variables:
@@ -43,7 +43,7 @@ Resources:
Properties:
CodeUri: .
Handler: helloworld.AppStream::handleRequest
- Runtime: java8
+ Runtime: java11
MemorySize: 512
Tracing: Active
Environment:
diff --git a/examples/powertools-examples-core-utilities/kotlin/README.md b/examples/powertools-examples-core-utilities/kotlin/README.md
index da9ec5b52..422e12742 100644
--- a/examples/powertools-examples-core-utilities/kotlin/README.md
+++ b/examples/powertools-examples-core-utilities/kotlin/README.md
@@ -1,7 +1,7 @@
# Powertools for AWS Lambda (Kotlin) - Core Utilities Example
This project demonstrates the Lambda for Powertools Kotlin module deployed using [Serverless Application Model](https://aws.amazon.com/serverless/sam/) with
-[Gradle](https://gradle.org/) running the build. This example is configured for Java 1.8 only; in order to use a newer version, check out the Gradle
+[Gradle](https://gradle.org/) running the build. This example is configured for Java 11 only; in order to use a newer version, check out the Gradle
configuration guide [in the main project README](../../../README.md).
You can also use `sam init` to create a new Gradle-powered Powertools application - choose to use the **AWS Quick Start Templates**,
diff --git a/examples/powertools-examples-core-utilities/kotlin/build.gradle.kts b/examples/powertools-examples-core-utilities/kotlin/build.gradle.kts
index 29a29b0c4..1c16db0db 100644
--- a/examples/powertools-examples-core-utilities/kotlin/build.gradle.kts
+++ b/examples/powertools-examples-core-utilities/kotlin/build.gradle.kts
@@ -1,5 +1,5 @@
plugins {
- id("io.freefair.aspectj.post-compile-weaving") version "6.6.3"
+ id("io.freefair.aspectj.post-compile-weaving") version "8.2.2"
kotlin("jvm") version "1.9.10"
}
@@ -21,19 +21,6 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
-tasks.compileKotlin {
- kotlinOptions {
- jvmTarget = "1.8"
- }
-}
-
-tasks.compileTestKotlin {
- kotlinOptions {
- jvmTarget = "1.8"
- }
-}
-
-// If using JDK 11 or higher, use the following instead:
-//kotlin {
-// jvmToolchain(11)
-//}
\ No newline at end of file
+kotlin {
+ jvmToolchain(11)
+}
\ No newline at end of file
diff --git a/examples/powertools-examples-core-utilities/kotlin/gradle/wrapper/gradle-wrapper.properties b/examples/powertools-examples-core-utilities/kotlin/gradle/wrapper/gradle-wrapper.properties
index 0d23ac00c..1af9e0930 100644
--- a/examples/powertools-examples-core-utilities/kotlin/gradle/wrapper/gradle-wrapper.properties
+++ b/examples/powertools-examples-core-utilities/kotlin/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
diff --git a/examples/powertools-examples-core-utilities/sam/pom.xml b/examples/powertools-examples-core-utilities/sam/pom.xml
index a88150f4b..3ddecc5e4 100644
--- a/examples/powertools-examples-core-utilities/sam/pom.xml
+++ b/examples/powertools-examples-core-utilities/sam/pom.xml
@@ -10,8 +10,8 @@
2.20.0
- 1.8
- 1.8
+ 11
+ 11
1.9.20
@@ -126,24 +126,4 @@
-
-
-
- jdk8
-
- (,11)
-
-
- 1.9.7
-
-
-
diff --git a/examples/powertools-examples-core-utilities/serverless/pom.xml b/examples/powertools-examples-core-utilities/serverless/pom.xml
index c92d0b653..7ebfdfc00 100644
--- a/examples/powertools-examples-core-utilities/serverless/pom.xml
+++ b/examples/powertools-examples-core-utilities/serverless/pom.xml
@@ -10,8 +10,8 @@
2.20.0
- 1.8
- 1.8
+ 11
+ 11
1.9.20
@@ -59,6 +59,7 @@
+ helloworld-lambda
dev.aspectj
@@ -126,24 +127,4 @@
-
-
-
- jdk8
-
- (,11)
-
-
- 1.9.7
-
-
-
diff --git a/examples/powertools-examples-core-utilities/terraform/pom.xml b/examples/powertools-examples-core-utilities/terraform/pom.xml
index d74ce7085..f508d9d3d 100644
--- a/examples/powertools-examples-core-utilities/terraform/pom.xml
+++ b/examples/powertools-examples-core-utilities/terraform/pom.xml
@@ -10,8 +10,8 @@
2.20.0
- 1.8
- 1.8
+ 11
+ 11
1.9.20
@@ -145,24 +145,4 @@
-
-
-
- jdk8
-
- (,11)
-
-
- 1.9.7
-
-
-
diff --git a/examples/powertools-examples-idempotency/pom.xml b/examples/powertools-examples-idempotency/pom.xml
index 901074ddb..b7fd3d832 100644
--- a/examples/powertools-examples-idempotency/pom.xml
+++ b/examples/powertools-examples-idempotency/pom.xml
@@ -24,8 +24,8 @@
2.20.0
- 1.8
- 1.8
+ 11
+ 11
1.9.20
@@ -198,24 +198,4 @@
-
-
-
- jdk8
-
- (,11)
-
-
- 1.9.7
-
-
-
diff --git a/examples/powertools-examples-parameters/pom.xml b/examples/powertools-examples-parameters/pom.xml
index cffab7a65..7a4af628c 100644
--- a/examples/powertools-examples-parameters/pom.xml
+++ b/examples/powertools-examples-parameters/pom.xml
@@ -8,8 +8,8 @@
Powertools for AWS Lambda (Java) library Examples - Parameters
- 1.8
- 1.8
+ 11
+ 11
1.9.20
@@ -108,24 +108,4 @@
-
-
-
- jdk8
-
- (,11)
-
-
- 1.9.7
-
-
-
diff --git a/examples/powertools-examples-serialization/pom.xml b/examples/powertools-examples-serialization/pom.xml
index 5d7036497..468c7d161 100644
--- a/examples/powertools-examples-serialization/pom.xml
+++ b/examples/powertools-examples-serialization/pom.xml
@@ -8,8 +8,8 @@
Powertools for AWS Lambda (Java) library Examples - Serialization
- 1.8
- 1.8
+ 11
+ 11
@@ -37,14 +37,6 @@
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
-
- true
-
-
org.apache.maven.plugins
diff --git a/examples/powertools-examples-validation/README.md b/examples/powertools-examples-validation/README.md
index 3f6790b0c..2f2028301 100644
--- a/examples/powertools-examples-validation/README.md
+++ b/examples/powertools-examples-validation/README.md
@@ -15,7 +15,7 @@ started with SAM in [the examples directory](../README.md)
To test the validation, we can POST a JSON object shaped like our schema:
```bash
- curl -X POST https://[REST-API-ID].execute-api.[REGION].amazonaws.com/Prod/hello/ -H "Content-Type: application/json" -d '{"address": "https://checkip.amazonaws.com"}'
+ curl -X POST https://[REST-API-ID].execute-api.[REGION].amazonaws.com/Prod/hello/ -H "Content-Type: application/json" -d '{"id": 123,"name":"The Hitchhikers Guide to the Galaxy","price":10.99}'
```
If we break the schema - for instance, by removing one of the compulsory fields,