|
63 | 63 | </dependency> |
64 | 64 |
|
65 | 65 | <!-- Test dependencies --> |
| 66 | + <dependency> |
| 67 | + <groupId>org.junit.jupiter</groupId> |
| 68 | + <artifactId>junit-jupiter-api</artifactId> |
| 69 | + <scope>test</scope> |
| 70 | + </dependency> |
| 71 | + <dependency> |
| 72 | + <groupId>org.junit.jupiter</groupId> |
| 73 | + <artifactId>junit-jupiter-engine</artifactId> |
| 74 | + <scope>test</scope> |
| 75 | + </dependency> |
| 76 | + <dependency> |
| 77 | + <groupId>org.slf4j</groupId> |
| 78 | + <artifactId>slf4j-simple</artifactId> |
| 79 | + <scope>test</scope> |
| 80 | + </dependency> |
| 81 | + <dependency> |
| 82 | + <groupId>software.amazon.lambda</groupId> |
| 83 | + <artifactId>powertools-common</artifactId> |
| 84 | + <version>${project.version}</version> |
| 85 | + <type>test-jar</type> |
| 86 | + <scope>test</scope> |
| 87 | + </dependency> |
| 88 | + <!-- DynamoDB Local for testing --> |
66 | 89 | <dependency> |
67 | 90 | <groupId>com.amazonaws</groupId> |
68 | 91 | <artifactId>DynamoDBLocal</artifactId> |
|
71 | 94 | <version>2.2.0</version> |
72 | 95 | <scope>test</scope> |
73 | 96 | </dependency> |
74 | | - <!--Needed when building locally on M1 Mac--> |
75 | | - <dependency> |
76 | | - <groupId>io.github.ganadist.sqlite4java</groupId> |
77 | | - <artifactId>libsqlite4java-osx-aarch64</artifactId> |
78 | | - <version>1.0.392</version> |
79 | | - <scope>test</scope> |
80 | | - <type>dylib</type> |
81 | | - </dependency> |
82 | 97 | </dependencies> |
| 98 | + |
| 99 | + <profiles> |
| 100 | + <profile> |
| 101 | + <id>generate-graalvm-files</id> |
| 102 | + <build> |
| 103 | + <plugins> |
| 104 | + <plugin> |
| 105 | + <groupId>org.apache.maven.plugins</groupId> |
| 106 | + <artifactId>maven-surefire-plugin</artifactId> |
| 107 | + <configuration> |
| 108 | + <argLine> |
| 109 | + -Dorg.graalvm.nativeimage.imagecode=agent |
| 110 | + -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image/software.amazon.lambda/powertools-idempotency-dynamodb,experimental-class-define-support |
| 111 | + --add-opens java.base/java.util=ALL-UNNAMED |
| 112 | + --add-opens java.base/java.lang=ALL-UNNAMED |
| 113 | + </argLine> |
| 114 | + </configuration> |
| 115 | + </plugin> |
| 116 | + </plugins> |
| 117 | + </build> |
| 118 | + </profile> |
| 119 | + <profile> |
| 120 | + <id>graalvm-native</id> |
| 121 | + <build> |
| 122 | + <plugins> |
| 123 | + <plugin> |
| 124 | + <groupId>org.graalvm.buildtools</groupId> |
| 125 | + <artifactId>native-maven-plugin</artifactId> |
| 126 | + <version>0.11.0</version> |
| 127 | + <extensions>true</extensions> |
| 128 | + <executions> |
| 129 | + <execution> |
| 130 | + <id>test-native</id> |
| 131 | + <goals> |
| 132 | + <goal>test</goal> |
| 133 | + </goals> |
| 134 | + <phase>test</phase> |
| 135 | + </execution> |
| 136 | + </executions> |
| 137 | + <configuration> |
| 138 | + <imageName>powertools-idempotency-dynamodb</imageName> |
| 139 | + <exclusions> |
| 140 | + <exclusion> |
| 141 | + <groupId>com.amazonaws</groupId> |
| 142 | + <artifactId>DynamoDBLocal</artifactId> |
| 143 | + </exclusion> |
| 144 | + </exclusions> |
| 145 | + <buildArgs> |
| 146 | + <buildArg>--add-opens java.base/java.util=ALL-UNNAMED</buildArg> |
| 147 | + <buildArg>--add-opens java.base/java.lang=ALL-UNNAMED</buildArg> |
| 148 | + <buildArg>--enable-url-protocols=http</buildArg> |
| 149 | + <buildArg>--no-fallback</buildArg> |
| 150 | + <buildArg>--verbose</buildArg> |
| 151 | + <buildArg>--native-image-info</buildArg> |
| 152 | + <buildArg>-H:+UnlockExperimentalVMOptions</buildArg> |
| 153 | + <buildArg>-H:Log=registerResource:5</buildArg> |
| 154 | + <buildArg>-H:+ReportExceptionStackTraces</buildArg> |
| 155 | + </buildArgs> |
| 156 | + </configuration> |
| 157 | + </plugin> |
| 158 | + </plugins> |
| 159 | + </build> |
| 160 | + </profile> |
| 161 | + </profiles> |
| 162 | + |
83 | 163 | <build> |
84 | 164 | <plugins> |
| 165 | + <!-- Copy DynamoDB Local JAR --> |
| 166 | + <plugin> |
| 167 | + <groupId>org.apache.maven.plugins</groupId> |
| 168 | + <artifactId>maven-dependency-plugin</artifactId> |
| 169 | + <executions> |
| 170 | + <execution> |
| 171 | + <id>copy-dynamodb-local</id> |
| 172 | + <phase>generate-test-resources</phase> |
| 173 | + <goals> |
| 174 | + <goal>copy-dependencies</goal> |
| 175 | + </goals> |
| 176 | + <configuration> |
| 177 | + <includeScope>test</includeScope> |
| 178 | + <excludeTransitive>false</excludeTransitive> |
| 179 | + <includeGroupIds> |
| 180 | + com.amazonaws,software.amazon.awssdk,org.eclipse.jetty,com.fasterxml.jackson.core,com.fasterxml.jackson.dataformat,com.fasterxml.jackson.datatype,com.almworks.sqlite4java,commons-cli,org.apache.commons,commons-logging,org.apache.logging.log4j,org.slf4j,org.reactivestreams,org.antlr,com.google.guava,jakarta.transaction</includeGroupIds> |
| 181 | + <outputDirectory>${project.build.directory}/dynamodb-local</outputDirectory> |
| 182 | + </configuration> |
| 183 | + </execution> |
| 184 | + </executions> |
| 185 | + </plugin> |
| 186 | + <!-- Start DynamoDB Local before tests --> |
| 187 | + <plugin> |
| 188 | + <groupId>org.codehaus.mojo</groupId> |
| 189 | + <artifactId>exec-maven-plugin</artifactId> |
| 190 | + <executions> |
| 191 | + <execution> |
| 192 | + <id>start-dynamodb-local</id> |
| 193 | + <phase>process-test-classes</phase> |
| 194 | + <goals> |
| 195 | + <goal>exec</goal> |
| 196 | + </goals> |
| 197 | + <configuration> |
| 198 | + <executable>java</executable> |
| 199 | + <workingDirectory>${project.build.directory}/dynamodb-local</workingDirectory> |
| 200 | + <arguments> |
| 201 | + <argument>-Djava.library.path=${project.build.directory}/dynamodb-local</argument> |
| 202 | + <argument>-cp</argument> |
| 203 | + <argument>${project.build.directory}/dynamodb-local/*</argument> |
| 204 | + <argument>com.amazonaws.services.dynamodbv2.local.main.ServerRunner</argument> |
| 205 | + <argument>-inMemory</argument> |
| 206 | + <argument>-port</argument> |
| 207 | + <argument>8000</argument> |
| 208 | + </arguments> |
| 209 | + <async>true</async> |
| 210 | + <asyncDestroyOnShutdown>true</asyncDestroyOnShutdown> |
| 211 | + </configuration> |
| 212 | + </execution> |
| 213 | + </executions> |
| 214 | + </plugin> |
85 | 215 | <plugin> |
86 | 216 | <groupId>org.apache.maven.plugins</groupId> |
87 | 217 | <artifactId>maven-jar-plugin</artifactId> |
|
94 | 224 | </archive> |
95 | 225 | </configuration> |
96 | 226 | </plugin> |
| 227 | + <!-- Configure Surefire to expose external DynamoDB Local address --> |
| 228 | + <plugin> |
| 229 | + <groupId>org.apache.maven.plugins</groupId> |
| 230 | + <artifactId>maven-surefire-plugin</artifactId> |
| 231 | + <configuration> |
| 232 | + <systemPropertyVariables> |
| 233 | + <dynamodb.endpoint>http://localhost:8000</dynamodb.endpoint> |
| 234 | + </systemPropertyVariables> |
| 235 | + </configuration> |
| 236 | + </plugin> |
97 | 237 | <plugin> |
98 | 238 | <groupId>dev.aspectj</groupId> |
99 | 239 | <artifactId>aspectj-maven-plugin</artifactId> |
|
0 commit comments