Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@ To send us a pull request, please:
5. Send us a pull request, answering any default questions in the pull request interface.
6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.


## Build Prerequisites

This project uses the Maven Toolchains Plugin to pin compilation to JDK 8. If you don't have a `~/.m2/toolchains.xml` configured, builds will fail with:

```
No toolchain found for type jdk [ version='[1.8,9)' ]
```

To fix this, copy the example file to your Maven config directory and update the path:

```bash
cp toolchains.xml.example ~/.m2/toolchains.xml
```

Then edit `~/.m2/toolchains.xml` and set `<jdkHome>` to your local JDK 8 installation path.

Note: if you use `actions/setup-java` in CI (as our GitHub Actions workflows do), this file is generated automatically.

GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).

Expand Down
26 changes: 26 additions & 0 deletions aws-lambda-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,32 @@
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<toolchains>
<jdk>
<!-- Range matches both "8" (e.g. actions/setup-java)
and "1.8" (legacy / hand-written toolchains). -->
<version>[1.8,9)</version>
</jdk>
</toolchains>
</configuration>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>dev</id>
Expand Down
21 changes: 21 additions & 0 deletions aws-lambda-java-events-sdk-transformer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<toolchains>
<jdk>
<!-- Range matches both "8" (e.g. actions/setup-java)
and "1.8" (legacy / hand-written toolchains). -->
<version>[1.8,9)</version>
</jdk>
</toolchains>
</configuration>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
Expand Down
26 changes: 26 additions & 0 deletions aws-lambda-java-events/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,32 @@
<junit-jupiter.version>5.12.2</junit-jupiter.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<toolchains>
<jdk>
<!-- Range matches both "8" (e.g. actions/setup-java)
and "1.8" (legacy / hand-written toolchains). -->
<version>[1.8,9)</version>
</jdk>
</toolchains>
</configuration>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Comment on lines +45 to +70

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: i see this is repeated across all the pom files, is it worth considering having a shared parent pom and have all the common stuff in there?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have considered this. it might make sense when we automate the deployment, but for now each module is independently versioned and released to Maven Central and the CI builds them in isolation. a parent POM introduces coupling (any parent change needs to be published to maven central before any child module can be released). for this PR it feels safer to keep the modules self contained

<distributionManagement>
<repository>
<id>sonatype-nexus-staging</id>
Expand Down
21 changes: 21 additions & 0 deletions aws-lambda-java-runtime-interface-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,27 @@
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<toolchains>
<jdk>
<!-- Range matches both "8" (e.g. actions/setup-java)
and "1.8" (legacy / hand-written toolchains). -->
<version>[1.8,9)</version>
</jdk>
</toolchains>
</configuration>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,21 @@ COPY --from=docker/buildx-bin:latest /buildx /usr/libexec/docker/cli-plugins/doc
ENV PATH="$PATH:/apache-maven/bin"
RUN mkdir /apache-maven && \
curl https://archive.apache.org/dist/maven/maven-3/3.8.7/binaries/apache-maven-3.8.7-bin.tar.gz | \
tar -xz -C /apache-maven --strip-components 1
tar -xz -C /apache-maven --strip-components 1

# Declare JDK 8 in toolchains.xml so maven-toolchains-plugin can resolve it
RUN mkdir -p /root/.m2 && \
cat > /root/.m2/toolchains.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>8</version>
</provides>
<configuration>
<jdkHome>${JAVA_HOME}</jdkHome>
</configuration>
</toolchain>
</toolchains>
EOF
21 changes: 21 additions & 0 deletions aws-lambda-java-serialization/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,27 @@
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<toolchains>
<jdk>
<!-- Range matches both "8" (e.g. actions/setup-java)
and "1.8" (legacy / hand-written toolchains). -->
<version>[1.8,9)</version>
</jdk>
</toolchains>
</configuration>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down
21 changes: 21 additions & 0 deletions aws-lambda-java-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,27 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<toolchains>
<jdk>
<!-- Range matches both "8" (e.g. actions/setup-java)
and "1.8" (legacy / hand-written toolchains). -->
<version>[1.8,9)</version>
</jdk>
</toolchains>
</configuration>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
21 changes: 21 additions & 0 deletions toolchains.xml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Maven Toolchains configuration for aws-lambda-java-libs.

This file tells Maven where to find JDK 8, which is required by the
maven-toolchains-plugin configured in each module's pom.xml.

To use: copy this file to ~/.m2/toolchains.xml and set the jdkHome
path to match your local JDK 8 installation.
-->
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>8</version>
</provides>
<configuration>
<jdkHome>/path/to/your/jdk8</jdkHome>
</configuration>
</toolchain>
</toolchains>
Loading