diff --git a/deploy/aws/README.md b/deploy/aws/README.md index 3949d0e6..15b35e14 100644 --- a/deploy/aws/README.md +++ b/deploy/aws/README.md @@ -9,6 +9,7 @@ This project contains source code and supporting files for a serverless applicat The application uses several AWS resources, including Lambda functions and an API Gateway API. These resources are defined in the `template.yaml` file in this project. You can update the template to add AWS resources through the same deployment process that updates your application code. See the [AWS SAM developer guide](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html) for deployment, usage and an introduction to SAM specification, the SAM CLI, and serverless application concepts. +[The AWS Toolkit Plugin](https://aws.amazon.com/de/intellij/) helps build the Lambda function without errors. ## Interface diff --git a/deploy/aws/java11Exec/pom.xml b/deploy/aws/java11Exec/pom.xml index 6cb880ad..2f9b4cb4 100644 --- a/deploy/aws/java11Exec/pom.xml +++ b/deploy/aws/java11Exec/pom.xml @@ -41,7 +41,7 @@ org.hamcrest - hamcrest-core + hamcrest 3.0 diff --git a/deploy/aws/java11Exec/src/main/java/poseidon/App.java b/deploy/aws/java11Exec/src/main/java/poseidon/App.java index 7beb1103..48b1591c 100644 --- a/deploy/aws/java11Exec/src/main/java/poseidon/App.java +++ b/deploy/aws/java11Exec/src/main/java/poseidon/App.java @@ -95,6 +95,8 @@ public APIGatewayProxyResponseEvent handleRequest(final APIGatewayV2WebSocketEve ProcessBuilder pb = new ProcessBuilder(cmd); pb.directory(workingDirectory); + Map env = pb.environment(); + env.put("CLASSPATH", ".:/var/task/lib/org.hamcrest.hamcrest-core-3.0.jar:/var/task/lib/junit.junit-4.13.2.jar:" + env.get("CLASSPATH")); Process p = pb.start(); InputStream stdout = p.getInputStream(), stderr = p.getErrorStream(); this.forwardOutput(p, stdout, stderr); diff --git a/deploy/aws/java11Exec/src/main/java/poseidon/SimpleMakefile.java b/deploy/aws/java11Exec/src/main/java/poseidon/SimpleMakefile.java index 7e5a16c6..4e86c330 100644 --- a/deploy/aws/java11Exec/src/main/java/poseidon/SimpleMakefile.java +++ b/deploy/aws/java11Exec/src/main/java/poseidon/SimpleMakefile.java @@ -71,8 +71,6 @@ private void parseRules(String makefile) { .map(s -> s.startsWith("@") ? s.substring(1) : s) .map(s -> s.contains("#") ? s.substring(0, s.indexOf("#")) : s) .filter(s -> !s.isEmpty()) - .map(s -> s.replaceAll("/usr/java/lib/hamcrest-core-1\\.3\\.jar", "/var/task/lib/org.hamcrest.hamcrest-core-1.3.jar")) - .map(s -> s.replaceAll("/usr/java/lib/junit-4\\.13\\.jar", "/var/task/lib/junit.junit-4.13.2.jar")) .toArray(String[]::new); rules.put(ruleName, trimmedCommands); diff --git a/deploy/aws/java11Exec/src/test/java/poseidon/SimpleMakefileTest.java b/deploy/aws/java11Exec/src/test/java/poseidon/SimpleMakefileTest.java index f3679410..18973605 100644 --- a/deploy/aws/java11Exec/src/test/java/poseidon/SimpleMakefileTest.java +++ b/deploy/aws/java11Exec/src/test/java/poseidon/SimpleMakefileTest.java @@ -39,8 +39,8 @@ public class SimpleMakefileTest { static final String SuccessfulMakefileWithAssignments = Base64.getEncoder().encodeToString( ("test:\n" + - "\tjavac -encoding utf8 -cp .:/usr/java/lib/hamcrest-core-1.3.jar:/usr/java/lib/junit-4.13.jar ${FILENAME}\n" + - "\tjava -Dfile.encoding=UTF8 -cp .:/usr/java/lib/hamcrest-core-1.3.jar:/usr/java/lib/junit-4.13.jar org.junit.runner.JUnitCore ${CLASS_NAME}\n" + "\tjavac -encoding utf8 ${FILENAME}\n" + + "\tjava -Dfile.encoding=UTF8 ${CLASS_NAME}\n" ).getBytes(StandardCharsets.UTF_8)); static final String SuccessfulMakefileWithComment = Base64.getEncoder().encodeToString( @@ -126,8 +126,8 @@ public void sucessfullMakeWithAssignments() { SimpleMakefile make = new SimpleMakefile(files); String cmd = make.parseCommand(command); - assertEquals("javac -encoding utf8 -cp .:/var/task/lib/org.hamcrest.hamcrest-core-1.3.jar:/var/task/lib/junit.junit-4.13.2.jar RecursiveMath-Test.java && " + - "java -Dfile.encoding=UTF8 -cp .:/var/task/lib/org.hamcrest.hamcrest-core-1.3.jar:/var/task/lib/junit.junit-4.13.2.jar org.junit.runner.JUnitCore RecursiveMath", cmd); + assertEquals("javac -encoding utf8 RecursiveMath-Test.java && " + + "java -Dfile.encoding=UTF8 RecursiveMath", cmd); } catch (NoMakefileFoundException | InvalidMakefileException | NoMakeCommandException ignored) { fail(); }