AWS Lambdas in Java should be packaged as an Uber JAR.
The maven-shade-plugin is used to build the Uber JAR. While configuring it in the pom.xml is the recommended way to use it, here we execute it from the command line to keep the pom.xml file agnostic to the cloud provider.
mvn package shade:shade
# This is the Maven "target" directory
BUILD_DIR=$(mvn help:evaluate -Dexpression=project.build.directory -q -DforceStdout)
# The Maven shade plugin adds the "original-" prefix to the non-shaded JAR.
# Here we select the shaded JAR which does not have this prefix.
JAR_FILE=$(ls ${BUILD_DIR} | grep '.jar$' | grep -v '^original')The AWS documentation describes all the possible ways to deploy your function.
For example, using the UodateFunctionCode API with the aws CLI:
aws lambda update-function-code \
--function-name ${FUNCTION_NAME} \
--zip-file fileb://./${BUILD_DIR}/${JAR_FILE}The handler is always fr.axelop.agnosticserverlessfunctions.FunctionInvoker::handleRequest.