Skip to content

Commit f30407c

Browse files
authored
[fix] Decouple samples from the parent pom (#1240)
1 parent 0dac6fe commit f30407c

File tree

9 files changed

+465
-69
lines changed

9 files changed

+465
-69
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
java-version: ${{ matrix.java }}
6262
cache: 'maven'
6363
- name: Build with Maven
64-
run: mvn -Pbuild-without-spotbugs -B package --file pom.xml
64+
run: mvn -Pbuild-without-spotbugs -B install --file pom.xml
6565
- name: Upload coverage to Codecov
6666
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # 3.1.1
6767
if: ${{ matrix.java == '11' }} # publish results once

examples/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
## aws-lambda-powertools-examples
22

33
This directory holds example projects demoing different components of the Powertools for AWS Lambda (Java).
4-
5-
4+
Each example can be copied from its subdirectory and used independently of the rest of this repository.

examples/pom.xml

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7+
<groupId>software.amazon.lambda</groupId>
78
<artifactId>powertools-examples</artifactId>
9+
<version>1.15.0</version>
810
<packaging>pom</packaging>
911

10-
<parent>
11-
<artifactId>powertools-parent</artifactId>
12-
<groupId>software.amazon.lambda</groupId>
13-
<version>1.15.0</version>
14-
</parent>
15-
1612
<name>Powertools for AWS Lambda (Java) library Examples</name>
1713
<description>
1814
A suite of examples accompanying for Powertools for AWS Lambda (Java).
@@ -32,32 +28,4 @@
3228
<maven.deploy.skip>true</maven.deploy.skip>
3329
</properties>
3430

35-
<build>
36-
<plugins>
37-
<plugin> <!-- skip coverage for examples -->
38-
<groupId>org.jacoco</groupId>
39-
<artifactId>jacoco-maven-plugin</artifactId>
40-
<executions>
41-
<execution>
42-
<goals>
43-
<goal>prepare-agent</goal>
44-
</goals>
45-
<configuration>
46-
<skip>true</skip>
47-
</configuration>
48-
</execution>
49-
<execution>
50-
<id>report</id>
51-
<goals>
52-
<goal>report</goal>
53-
</goals>
54-
<configuration>
55-
<skip>true</skip>
56-
</configuration>
57-
</execution>
58-
</executions>
59-
</plugin>
60-
</plugins>
61-
</build>
62-
6331
</project>

examples/powertools-examples-core/pom.xml

Lines changed: 85 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>software.amazon.lambda.examples</groupId>
6+
<version>1.15.0</version>
47
<artifactId>powertools-examples-core</artifactId>
58
<packaging>jar</packaging>
6-
<name>Powertools for AWS Lambda (Java) library Examples - Core</name>
79

8-
<parent>
9-
<artifactId>powertools-examples</artifactId>
10-
<groupId>software.amazon.lambda</groupId>
11-
<version>1.15.0</version>
12-
</parent>
10+
<name>Powertools for AWS Lambda (Java) library Examples - Core</name>
11+
12+
<properties>
13+
<log4j.version>2.20.0</log4j.version>
14+
<maven.compiler.source>1.8</maven.compiler.source>
15+
<maven.compiler.target>1.8</maven.compiler.target>
16+
</properties>
1317

1418
<dependencies>
1519
<dependency>
@@ -118,4 +122,79 @@
118122
</plugin>
119123
</plugins>
120124
</build>
125+
<profiles>
126+
<!-- Use a profile to enforce AspectJ version 1.9.7 if we are Java 1.8 otherwise we'll get class
127+
version mismatch issues. All subsequent Java releases build with the default AspectJ configuration
128+
on the project.
129+
130+
Note:
131+
- if you are running Java > 1.8, you can remove this profile altogether
132+
- If you are running on Java 1.8, you should apply the aspectJ version here to the project, and remove
133+
the profile.
134+
-->
135+
<profile>
136+
<id>jdk8</id>
137+
<activation>
138+
<jdk>(,11)</jdk> <!-- 8 -->
139+
</activation>
140+
<properties>
141+
<aspectj.version>1.9.7</aspectj.version>
142+
</properties>
143+
<dependencyManagement>
144+
<dependencies>
145+
<dependency>
146+
<groupId>org.aspectj</groupId>
147+
<artifactId>aspectjtools</artifactId>
148+
<version>${aspectj.version}</version>
149+
</dependency>
150+
</dependencies>
151+
</dependencyManagement>
152+
<build>
153+
<pluginManagement>
154+
<plugins>
155+
<plugin>
156+
<groupId>dev.aspectj</groupId>
157+
<artifactId>aspectj-maven-plugin</artifactId>
158+
<version>${aspectj.plugin.version}</version>
159+
<configuration>
160+
<source>${maven.compiler.source}</source>
161+
<target>${maven.compiler.target}</target>
162+
<complianceLevel>${maven.compiler.target}</complianceLevel>
163+
<aspectLibraries>
164+
<aspectLibrary>
165+
<groupId>software.amazon.lambda</groupId>
166+
<artifactId>powertools-tracing</artifactId>
167+
</aspectLibrary>
168+
<aspectLibrary>
169+
<groupId>software.amazon.lambda</groupId>
170+
<artifactId>powertools-logging</artifactId>
171+
</aspectLibrary>
172+
<aspectLibrary>
173+
<groupId>software.amazon.lambda</groupId>
174+
<artifactId>powertools-metrics</artifactId>
175+
</aspectLibrary>
176+
</aspectLibraries>
177+
</configuration>
178+
<executions>
179+
<execution>
180+
<goals>
181+
<goal>compile</goal>
182+
<goal>test-compile</goal>
183+
</goals>
184+
</execution>
185+
</executions>
186+
<!-- Enforce aspectJ 1.9.7 -->
187+
<dependencies>
188+
<dependency>
189+
<groupId>org.aspectj</groupId>
190+
<artifactId>aspectjtools</artifactId>
191+
<version>${aspectj.version}</version>
192+
</dependency>
193+
</dependencies>
194+
</plugin>
195+
</plugins>
196+
</pluginManagement>
197+
</build>
198+
</profile>
199+
</profiles>
121200
</project>

examples/powertools-examples-idempotency/pom.xml

Lines changed: 83 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>software.amazon.lambda.examples</groupId>
6+
<version>1.15.0</version>
47
<artifactId>powertools-examples-idempotency</artifactId>
58
<packaging>jar</packaging>
69
<name>Powertools for AWS Lambda (Java) library Examples - Idempotency</name>
710

8-
<parent>
9-
<artifactId>powertools-examples</artifactId>
10-
<groupId>software.amazon.lambda</groupId>
11-
<version>1.15.0</version>
12-
</parent>
11+
<properties>
12+
<log4j.version>2.20.0</log4j.version>
13+
<maven.compiler.source>1.8</maven.compiler.source>
14+
<maven.compiler.target>1.8</maven.compiler.target>
15+
</properties>
1316

1417
<dependencies>
1518
<dependency>
@@ -168,6 +171,81 @@
168171
</plugin>
169172
</plugins>
170173
</build>
174+
<profiles>
175+
<!-- Use a profile to enforce AspectJ version 1.9.7 if we are Java 1.8 otherwise we'll get class
176+
version mismatch issues. All subsequent Java releases build with the default AspectJ configuration
177+
on the project.
178+
179+
Note:
180+
- if you are running Java > 1.8, you can remove this profile altogether
181+
- If you are running on Java 1.8, you should apply the aspectJ version here to the project, and remove
182+
the profile.
183+
-->
184+
<profile>
185+
<id>jdk8</id>
186+
<activation>
187+
<jdk>(,11)</jdk> <!-- 8 -->
188+
</activation>
189+
<properties>
190+
<aspectj.version>1.9.7</aspectj.version>
191+
</properties>
192+
<dependencyManagement>
193+
<dependencies>
194+
<dependency>
195+
<groupId>org.aspectj</groupId>
196+
<artifactId>aspectjtools</artifactId>
197+
<version>${aspectj.version}</version>
198+
</dependency>
199+
</dependencies>
200+
</dependencyManagement>
201+
<build>
202+
<pluginManagement>
203+
<plugins>
204+
<plugin>
205+
<groupId>dev.aspectj</groupId>
206+
<artifactId>aspectj-maven-plugin</artifactId>
207+
<version>${aspectj.plugin.version}</version>
208+
<configuration>
209+
<source>${maven.compiler.source}</source>
210+
<target>${maven.compiler.target}</target>
211+
<complianceLevel>${maven.compiler.target}</complianceLevel>
212+
<aspectLibraries>
213+
<aspectLibrary>
214+
<groupId>software.amazon.lambda</groupId>
215+
<artifactId>powertools-tracing</artifactId>
216+
</aspectLibrary>
217+
<aspectLibrary>
218+
<groupId>software.amazon.lambda</groupId>
219+
<artifactId>powertools-logging</artifactId>
220+
</aspectLibrary>
221+
<aspectLibrary>
222+
<groupId>software.amazon.lambda</groupId>
223+
<artifactId>powertools-idempotency</artifactId>
224+
</aspectLibrary>
225+
</aspectLibraries>
226+
</configuration>
227+
<executions>
228+
<execution>
229+
<goals>
230+
<goal>compile</goal>
231+
<goal>test-compile</goal>
232+
</goals>
233+
</execution>
234+
</executions>
235+
<!-- Enforce aspectJ 1.9.7 -->
236+
<dependencies>
237+
<dependency>
238+
<groupId>org.aspectj</groupId>
239+
<artifactId>aspectjtools</artifactId>
240+
<version>${aspectj.version}</version>
241+
</dependency>
242+
</dependencies>
243+
</plugin>
244+
</plugins>
245+
</pluginManagement>
246+
</build>
247+
</profile>
248+
</profiles>
171249
<repositories>
172250
<repository>
173251
<id>dynamodb-local-oregon</id>

examples/powertools-examples-parameters/pom.xml

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4+
<groupId>software.amazon.lambda.examples</groupId>
5+
<version>1.15.0</version>
46
<artifactId>powertools-examples-parameters</artifactId>
57
<packaging>jar</packaging>
68
<name>Powertools for AWS Lambda (Java) library Examples - Parameters</name>
79

8-
<parent>
9-
<artifactId>powertools-examples</artifactId>
10-
<groupId>software.amazon.lambda</groupId>
11-
<version>1.15.0</version>
12-
</parent>
13-
10+
<properties>
11+
<maven.compiler.source>1.8</maven.compiler.source>
12+
<maven.compiler.target>1.8</maven.compiler.target>
13+
</properties>
14+
1415
<dependencies>
1516
<dependency>
1617
<groupId>software.amazon.lambda</groupId>
@@ -87,4 +88,68 @@
8788
</plugin>
8889
</plugins>
8990
</build>
91+
<profiles>
92+
<!-- Use a profile to enforce AspectJ version 1.9.7 if we are Java 1.8 otherwise we'll get class
93+
version mismatch issues. All subsequent Java releases build with the default AspectJ configuration
94+
on the project.
95+
96+
Note:
97+
- if you are running Java > 1.8, you can remove this profile altogether
98+
- If you are running on Java 1.8, you should apply the aspectJ version here to the project, and remove
99+
the profile.
100+
-->
101+
<profile>
102+
<id>jdk8</id>
103+
<activation>
104+
<jdk>(,11)</jdk> <!-- 8 -->
105+
</activation>
106+
<properties>
107+
<aspectj.version>1.9.7</aspectj.version>
108+
</properties>
109+
<dependencyManagement>
110+
<dependencies>
111+
<dependency>
112+
<groupId>org.aspectj</groupId>
113+
<artifactId>aspectjtools</artifactId>
114+
<version>${aspectj.version}</version>
115+
</dependency>
116+
</dependencies>
117+
</dependencyManagement>
118+
<build>
119+
<pluginManagement>
120+
<plugins>
121+
<plugin>
122+
<groupId>dev.aspectj</groupId>
123+
<artifactId>aspectj-maven-plugin</artifactId>
124+
<version>${aspectj.plugin.version}</version>
125+
<configuration>
126+
<source>${maven.compiler.source}</source>
127+
<target>${maven.compiler.target}</target>
128+
<complianceLevel>${maven.compiler.target}</complianceLevel>
129+
<Xlint>ignore</Xlint>
130+
<encoding>UTF-8</encoding>
131+
</configuration>
132+
<executions>
133+
<execution>
134+
<phase>process-sources</phase>
135+
<goals>
136+
<goal>compile</goal>
137+
<goal>test-compile</goal>
138+
</goals>
139+
</execution>
140+
</executions>
141+
<!-- Enforce aspectJ 1.9.7 -->
142+
<dependencies>
143+
<dependency>
144+
<groupId>org.aspectj</groupId>
145+
<artifactId>aspectjtools</artifactId>
146+
<version>${aspectj.version}</version>
147+
</dependency>
148+
</dependencies>
149+
</plugin>
150+
</plugins>
151+
</pluginManagement>
152+
</build>
153+
</profile>
154+
</profiles>
90155
</project>

0 commit comments

Comments
 (0)