Skip to content

Commit 555b3f5

Browse files
committed
build: centralize module versions in a parent POM
1 parent 3bde5cb commit 555b3f5

11 files changed

Lines changed: 200 additions & 25 deletions

File tree

.github/workflows/release.yml

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ jobs:
167167

168168
# Cross-module gate: serialization has no tests in its own build, so the
169169
# `mvn verify` above exercises nothing. Its behavioral coverage lives in
170-
# aws-lambda-java-tests, which depends on serialization via a version
171-
# property. Install the just-built serialization and run that suite
172-
# against it, so we never publish serialization the suite hasn't exercised.
170+
# aws-lambda-java-tests, which depends on it via the parent version map.
171+
# Install the just-built serialization and run that suite against it, so
172+
# we never publish serialization the suite hasn't exercised.
173173
- name: Run cross-module test gate
174174
run: |
175175
case "$MODULE" in
@@ -179,8 +179,10 @@ jobs:
179179
echo "::group::Installing $MODULE $MOD_VER for the gate"
180180
mvn install -DskipTests --file "$MODULE/pom.xml"
181181
echo "::endgroup::"
182-
echo "::notice::Gating $MODULE on aws-lambda-java-tests (aws-lambda-java-serialization.version=$MOD_VER)"
183-
mvn verify -Daws-lambda-java-serialization.version="$MOD_VER" --file aws-lambda-java-tests/pom.xml
182+
echo "::notice::Gating $MODULE on aws-lambda-java-tests (lambda.serialization.version=$MOD_VER)"
183+
# Override the map property so the suite runs against the
184+
# just-built serialization, not the version pinned in the map.
185+
mvn verify -Dlambda.serialization.version="$MOD_VER" --file aws-lambda-java-tests/pom.xml
184186
;;
185187
*)
186188
echo "::notice::No cross-module test gate for $MODULE"
@@ -257,16 +259,44 @@ jobs:
257259
-Darguments="-gs $MAVEN_SETTINGS -Prelease -Dgpg.keyname=$GPG_KEYNAME -Dgpg.passphrase=$GPG_PASSPHRASE" \
258260
--file "$MODULE/pom.xml"
259261
260-
# Bump the lastPublished comment under <version>; rides in the bump PR.
261-
- name: Record last published version in POM
262+
# Record the published version in the two places that track it, from the
263+
# same EFFECTIVE_RELEASE_VERSION in one commit so they can't drift:
264+
# (1) the module's lastPublished comment (informational, every module) and
265+
# (2) the parent version map (functional, only for modules others depend
266+
# on). Rides in the version-bump PR below (main is protected).
267+
- name: Record released version (POM lastPublished + parent version map)
262268
if: ${{ github.event.inputs.skip_publish != 'true' }}
263269
run: |
264-
if ! grep -q "<!-- lastPublished:" "$MODULE/pom.xml"; then
265-
echo "::notice::$MODULE has no lastPublished comment; skipping"
266-
exit 0
270+
# (1) Module's lastPublished annotation.
271+
if grep -q "<!-- lastPublished:" "$MODULE/pom.xml"; then
272+
sed -i "s|<!-- lastPublished:.*-->|<!-- lastPublished: ${EFFECTIVE_RELEASE_VERSION} (auto-updated by release.yml) -->|" "$MODULE/pom.xml"
273+
git add "$MODULE/pom.xml"
274+
else
275+
echo "::notice::$MODULE has no lastPublished comment; skipping annotation"
276+
fi
277+
278+
# (2) Parent version map — keyed only for modules other modules depend on.
279+
case "$MODULE" in
280+
aws-lambda-java-core) PROP=lambda.core.version ;;
281+
aws-lambda-java-events) PROP=lambda.events.version ;;
282+
aws-lambda-java-serialization) PROP=lambda.serialization.version ;;
283+
*) PROP="" ;;
284+
esac
285+
if [ -n "$PROP" ]; then
286+
PROP_RE="${PROP//./\\.}"
287+
sed -i.bak -E "s|(<${PROP_RE}>)[^<]*(</${PROP_RE}>)|\1${EFFECTIVE_RELEASE_VERSION}\2|" pom.xml
288+
rm -f pom.xml.bak
289+
git add pom.xml
290+
else
291+
echo "::notice::$MODULE has no internal consumers; version map unchanged"
292+
fi
293+
294+
# One commit for both records, or nothing if neither changed.
295+
if git diff --cached --quiet; then
296+
echo "::notice::$MODULE already recorded at ${EFFECTIVE_RELEASE_VERSION}; nothing to commit"
297+
else
298+
git commit -m "chore(release): record ${MODULE} ${EFFECTIVE_RELEASE_VERSION} (lastPublished + version map)"
267299
fi
268-
sed -i "s|<!-- lastPublished:.*-->|<!-- lastPublished: ${EFFECTIVE_RELEASE_VERSION} (auto-updated by release.yml) -->|" "$MODULE/pom.xml"
269-
git commit -am "chore(release): record ${MODULE} lastPublished=${EFFECTIVE_RELEASE_VERSION}"
270300
271301
# Prepend the changelog entry so it ships in the version-bump PR. Passed
272302
# via env, never interpolated into the script, so it can't inject shell.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,7 @@ experimental/aws-lambda-java-profiler/integration_tests/helloworld/bin
3939
.kiro
4040
build
4141
mise.toml
42+
43+
# flatten-maven-plugin generates this self-contained POM at build time; it is
44+
# published in place of the raw module POM and must never be committed.
45+
.flattened-pom.xml

RELEASING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Releasable modules: `aws-lambda-java-core`, `aws-lambda-java-events`,
3232
2. Builds and tests the module.
3333
3. Publishes to Maven Central and pushes the tag `<module>-<version>`.
3434
4. Opens a **version-bump PR** into `main` with the next `-SNAPSHOT`, the updated
35-
`lastPublished` comment, and your changelog entry.
35+
`lastPublished` comment, the parent POM's version-map entry (for modules other
36+
modules depend on: core, events, serialization), and your changelog entry.
3637
5. Creates a GitHub Release on the tag from your changelog entry.
3738

3839
Merge the version-bump PR to return `main` to a clean `-SNAPSHOT` state.

aws-lambda-java-core/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6+
<parent>
7+
<groupId>com.amazonaws</groupId>
8+
<artifactId>aws-lambda-java-libs-parent</artifactId>
9+
<version>1.0.0</version>
10+
<relativePath>../pom.xml</relativePath>
11+
</parent>
12+
613
<groupId>com.amazonaws</groupId>
714
<artifactId>aws-lambda-java-core</artifactId>
815
<version>1.4.1-SNAPSHOT</version>

aws-lambda-java-events-sdk-transformer/pom.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.amazonaws</groupId>
6+
<parent>
7+
<groupId>com.amazonaws</groupId>
8+
<artifactId>aws-lambda-java-libs-parent</artifactId>
9+
<version>1.0.0</version>
10+
<relativePath>../pom.xml</relativePath>
11+
</parent>
12+
713
<artifactId>aws-lambda-java-events-sdk-transformer</artifactId>
814
<version>3.1.2-SNAPSHOT</version>
915
<!-- lastPublished: 3.1.1 (auto-updated by release.yml) -->
@@ -69,7 +75,7 @@
6975
<dependency>
7076
<groupId>com.amazonaws</groupId>
7177
<artifactId>aws-lambda-java-events</artifactId>
72-
<version>3.16.1</version>
78+
<!-- version managed by parent -->
7379
<scope>provided</scope>
7480
</dependency>
7581

aws-lambda-java-events/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6+
<parent>
7+
<groupId>com.amazonaws</groupId>
8+
<artifactId>aws-lambda-java-libs-parent</artifactId>
9+
<version>1.0.0</version>
10+
<relativePath>../pom.xml</relativePath>
11+
</parent>
12+
613
<groupId>com.amazonaws</groupId>
714
<artifactId>aws-lambda-java-events</artifactId>
815
<version>3.16.2-SNAPSHOT</version>

aws-lambda-java-log4j2/pom.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.amazonaws</groupId>
6+
<parent>
7+
<groupId>com.amazonaws</groupId>
8+
<artifactId>aws-lambda-java-libs-parent</artifactId>
9+
<version>1.0.0</version>
10+
<relativePath>../pom.xml</relativePath>
11+
</parent>
12+
713
<artifactId>aws-lambda-java-log4j2</artifactId>
814
<version>1.6.5-SNAPSHOT</version>
915
<!-- lastPublished: 1.6.4 (auto-updated by release.yml) -->
@@ -53,7 +59,7 @@
5359
<dependency>
5460
<groupId>com.amazonaws</groupId>
5561
<artifactId>aws-lambda-java-core</artifactId>
56-
<version>1.2.3</version>
62+
<!-- version managed by parent (was 1.2.3) -->
5763
</dependency>
5864
<dependency>
5965
<groupId>org.apache.logging.log4j</groupId>

aws-lambda-java-runtime-interface-client/pom.xml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
44
<modelVersion>4.0.0</modelVersion>
5-
<groupId>com.amazonaws</groupId>
5+
6+
<parent>
7+
<groupId>com.amazonaws</groupId>
8+
<artifactId>aws-lambda-java-libs-parent</artifactId>
9+
<version>1.0.0</version>
10+
<relativePath>../pom.xml</relativePath>
11+
</parent>
12+
613
<artifactId>aws-lambda-java-runtime-interface-client</artifactId>
714
<version>2.12.0-SNAPSHOT</version>
815
<packaging>jar</packaging>
@@ -65,12 +72,12 @@
6572
<dependency>
6673
<groupId>com.amazonaws</groupId>
6774
<artifactId>aws-lambda-java-core</artifactId>
68-
<version>1.4.0</version>
75+
<!-- version managed by parent -->
6976
</dependency>
7077
<dependency>
7178
<groupId>com.amazonaws</groupId>
7279
<artifactId>aws-lambda-java-serialization</artifactId>
73-
<version>1.4.1</version>
80+
<!-- version managed by parent -->
7481
</dependency>
7582
<dependency>
7683
<groupId>software.amazon.awssdk</groupId>

aws-lambda-java-serialization/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
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>
44

5+
<parent>
6+
<groupId>com.amazonaws</groupId>
7+
<artifactId>aws-lambda-java-libs-parent</artifactId>
8+
<version>1.0.0</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
512
<groupId>com.amazonaws</groupId>
613
<artifactId>aws-lambda-java-serialization</artifactId>
714
<version>1.4.2-SNAPSHOT</version>

aws-lambda-java-tests/pom.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
44
<modelVersion>4.0.0</modelVersion>
55

6-
<groupId>com.amazonaws</groupId>
6+
<parent>
7+
<groupId>com.amazonaws</groupId>
8+
<artifactId>aws-lambda-java-libs-parent</artifactId>
9+
<version>1.0.0</version>
10+
<relativePath>../pom.xml</relativePath>
11+
</parent>
12+
713
<artifactId>aws-lambda-java-tests</artifactId>
814
<version>1.1.3-SNAPSHOT</version>
915
<!-- lastPublished: 1.1.2 (auto-updated by release.yml) -->
@@ -44,8 +50,7 @@
4450
-->
4551
<junit.version>5.9.2</junit.version>
4652
<jacoco.maven.plugin.version>0.8.7</jacoco.maven.plugin.version>
47-
<aws-lambda-java-serialization.version>1.4.1</aws-lambda-java-serialization.version>
48-
<aws-lambda-java-events.version>3.16.1</aws-lambda-java-events.version>
53+
<!-- serialization / events versions come from the parent version map. -->
4954
<commons-lang3.version>3.18.0</commons-lang3.version>
5055
<assertj-core.version>3.27.7</assertj-core.version>
5156
</properties>
@@ -54,12 +59,10 @@
5459
<dependency>
5560
<groupId>com.amazonaws</groupId>
5661
<artifactId>aws-lambda-java-serialization</artifactId>
57-
<version>${aws-lambda-java-serialization.version}</version>
5862
</dependency>
5963
<dependency>
6064
<groupId>com.amazonaws</groupId>
6165
<artifactId>aws-lambda-java-events</artifactId>
62-
<version>${aws-lambda-java-events.version}</version>
6366
</dependency>
6467
<dependency>
6568
<groupId>org.junit.jupiter</groupId>

0 commit comments

Comments
 (0)