Skip to content

Commit adbd750

Browse files
authored
chore(v2): remove java 1.8 relics from the code (#1659)
* remove java 1.8 relics
1 parent 1317da4 commit adbd750

File tree

20 files changed

+59
-603
lines changed

20 files changed

+59
-603
lines changed

.github/workflows/pr_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
strategy:
5252
max-parallel: 5
5353
matrix:
54-
java: [8, 11, 17, 21]
54+
java: [11, 17, 21]
5555
name: Java ${{ matrix.java }}
5656
env:
5757
JAVA: ${{ matrix.java }}

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
1414
with:
1515
distribution: 'corretto'
16-
java-version: 8
16+
java-version: 11
1717
server-id: ossrh
1818
server-username: MAVEN_USERNAME
1919
server-password: MAVEN_PASSWORD

.github/workflows/run-e2e-tests.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
strategy:
3434
max-parallel: 4
3535
matrix:
36-
java: [ 8, 11, 17, 21 ]
36+
java: [ 11, 17, 21 ]
3737
name: End-to-end tests java${{ matrix.java }}
3838
env:
3939
AWS_DEFAULT_REGION: eu-west-1
@@ -54,12 +54,7 @@ jobs:
5454
with:
5555
role-to-assume: ${{ secrets.AWS_ROLE_ARN_TO_ASSUME }}
5656
aws-region: ${{ env.AWS_DEFAULT_REGION }}
57-
58-
- name: Build with Maven Java 8
59-
if: ${{ matrix.java == '8' }} # If 8 exclude the examples directory
60-
run: mvn -DskipTests 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'
6157
- name: Build with Maven
62-
if: ${{ matrix.java != '8' }} # If not 8 don't exclude the examples directory
6358
run: mvn -DskipTests install --file pom.xml
6459
- name: Run e2e test with Maven
6560
run: mvn -Pe2e -B verify --file powertools-e2e-tests/pom.xml

.github/workflows/spotbugs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525
steps:
2626
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
27-
- name: Setup java JDK 1.8
27+
- name: Setup java JDK 11
2828
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
2929
with:
3030
distribution: 'corretto'

README.md

+7-81
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Powertools for AWS Lambda (Java) is available in Maven Central. You can use your
3838
</dependencies>
3939
```
4040

41-
Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project. A different configuration is needed for projects on Java 8.
41+
Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project.
4242

4343
<details>
44-
<summary><b>Maven - Java 11 and newer</b></summary>
44+
<summary><b>Maven</b></summary>
4545

4646
```xml
4747
<build>
@@ -52,9 +52,9 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
5252
<artifactId>aspectj-maven-plugin</artifactId>
5353
<version>1.13.1</version>
5454
<configuration>
55-
<source>1.8</source>
56-
<target>1.8</target>
57-
<complianceLevel>1.8</complianceLevel>
55+
<source>11</source>
56+
<target>11</target>
57+
<complianceLevel>11</complianceLevel>
5858
<aspectLibraries>
5959
<aspectLibrary>
6060
<groupId>software.amazon.lambda</groupId>
@@ -85,51 +85,7 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
8585
</details>
8686

8787
<details>
88-
<summary><b>Maven - Java 8</b></summary>
89-
90-
```xml
91-
<build>
92-
<plugins>
93-
...
94-
<plugin>
95-
<groupId>org.codehaus.mojo</groupId>
96-
<artifactId>aspectj-maven-plugin</artifactId>
97-
<version>1.14.0</version>
98-
<configuration>
99-
<source>1.8</source>
100-
<target>1.8</target>
101-
<complianceLevel>1.8</complianceLevel>
102-
<aspectLibraries>
103-
<aspectLibrary>
104-
<groupId>software.amazon.lambda</groupId>
105-
<artifactId>powertools-logging</artifactId>
106-
</aspectLibrary>
107-
<aspectLibrary>
108-
<groupId>software.amazon.lambda</groupId>
109-
<artifactId>powertools-tracing</artifactId>
110-
</aspectLibrary>
111-
<aspectLibrary>
112-
<groupId>software.amazon.lambda</groupId>
113-
<artifactId>powertools-metrics</artifactId>
114-
</aspectLibrary>
115-
</aspectLibraries>
116-
</configuration>
117-
<executions>
118-
<execution>
119-
<goals>
120-
<goal>compile</goal>
121-
</goals>
122-
</execution>
123-
</executions>
124-
</plugin>
125-
...
126-
</plugins>
127-
</build>
128-
```
129-
</details>
130-
131-
<details>
132-
<summary><b>Gradle - Java 11+</b></summary>
88+
<summary><b>Gradle</b></summary>
13389

13490
```groovy
13591
@@ -160,38 +116,9 @@ Next, configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lam
160116
```
161117
</details>
162118

163-
<details>
164-
<summary><b>Gradle - Java 8</b></summary>
165-
166-
```groovy
167-
plugins {
168-
id 'java'
169-
id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
170-
}
171-
172-
// the freefair aspect plugins targets gradle 7.6.1
173-
// https://docs.freefair.io/gradle-plugins/6.6.3/reference/
174-
wrapper {
175-
gradleVersion = "7.6.1"
176-
}
177-
178-
repositories {
179-
mavenCentral()
180-
}
181-
182-
dependencies {
183-
aspect 'software.amazon.lambda:powertools-logging:{{ powertools.version }}'
184-
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
185-
aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}'
186-
}
187-
188-
sourceCompatibility = 1.8
189-
targetCompatibility = 1.8
190-
```
191-
</details>
192119

193120
### Java Compatibility
194-
Powertools for AWS Lambda (Java) supports all Java version from 8 up to 21 as well as the
121+
Powertools for AWS Lambda (Java) supports all Java version from 11 up to 21 as well as the
195122
[corresponding Lambda runtimes](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html).
196123
For the modules that provide annotations, Powertools for AWS Lambda (Java) leverages the **aspectj** library.
197124
You may need to add the good version of `aspectjrt` to your dependencies based on the JDK used for building your function:
@@ -209,7 +136,6 @@ You may need to add the good version of `aspectjrt` to your dependencies based o
209136

210137
| JDK version | aspectj version |
211138
|-------------|-----------------|
212-
| `1.8` | `1.9.7` |
213139
| `11-17` | `1.9.20.1` |
214140
| `21` | `1.9.21` |
215141

docs/core/tracing.md

+2-70
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ a provides functionality to reduce the overhead of performing common tracing tas
1717

1818
## Install
1919

20-
Depending on your version of Java (either Java 1.8 or 11+), the configuration slightly changes.
21-
22-
=== "Maven Java 11+"
20+
=== "Maven"
2321

2422
```xml hl_lines="3-7 16 18 24-27"
2523
<dependencies>
@@ -64,52 +62,7 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
6462
</build>
6563
```
6664

67-
=== "Maven Java 1.8"
68-
69-
```xml hl_lines="3-7 16 18 24-27"
70-
<dependencies>
71-
...
72-
<dependency>
73-
<groupId>software.amazon.lambda</groupId>
74-
<artifactId>powertools-tracing</artifactId>
75-
<version>{{ powertools.version }}</version>
76-
</dependency>
77-
...
78-
</dependencies>
79-
...
80-
<!-- configure the aspectj-maven-plugin to compile-time weave (CTW) the aws-lambda-powertools-java aspects into your project -->
81-
<build>
82-
<plugins>
83-
...
84-
<plugin>
85-
<groupId>org.codehaus.mojo</groupId>
86-
<artifactId>aspectj-maven-plugin</artifactId>
87-
<version>1.14.0</version>
88-
<configuration>
89-
<source>1.8</source>
90-
<target>1.8</target>
91-
<complianceLevel>1.8</complianceLevel>
92-
<aspectLibraries>
93-
<aspectLibrary>
94-
<groupId>software.amazon.lambda</groupId>
95-
<artifactId>powertools-tracing</artifactId>
96-
</aspectLibrary>
97-
</aspectLibraries>
98-
</configuration>
99-
<executions>
100-
<execution>
101-
<goals>
102-
<goal>compile</goal>
103-
</goals>
104-
</execution>
105-
</executions>
106-
</plugin>
107-
...
108-
</plugins>
109-
</build>
110-
```
111-
112-
=== "Gradle Java 11+"
65+
=== "Gradle"
11366

11467
```groovy hl_lines="3 11"
11568
plugins {
@@ -129,27 +82,6 @@ Depending on your version of Java (either Java 1.8 or 11+), the configuration sl
12982
targetCompatibility = 11
13083
```
13184

132-
=== "Gradle Java 1.8"
133-
134-
```groovy hl_lines="3 11"
135-
plugins {
136-
id 'java'
137-
id 'io.freefair.aspectj.post-compile-weaving' version '6.6.3'
138-
}
139-
140-
repositories {
141-
mavenCentral()
142-
}
143-
144-
dependencies {
145-
aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}'
146-
}
147-
148-
sourceCompatibility = 1.8
149-
targetCompatibility = 1.8
150-
```
151-
152-
15385
## Initialization
15486

15587
Before your use this utility, your AWS Lambda function [must have permissions](https://docs.aws.amazon.com/lambda/latest/dg/services-xray.html#services-xray-permissions) to send traces to AWS X-Ray.

0 commit comments

Comments
 (0)