I'm new to AWS Lambdas. Running Java 11 and using IntelliJ.
We currently have a layer which contains a lot of dependencies so our lambdas don't have to include all of them. We now need to write a new set of lambdas which will have some additional common functionality, so I want to write another set of Common code, which also depends are our existing dependency layer. Then, all our new lambdas will include the Common code, which also includes the existing layer
In my new Common code, I reference the dependency layer like this
<dependency>
<groupId>com.xxx</groupId>
<artifactId>my-layer</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
scope=provided is specified so that the layer is not included in the Common jar, but instead will be provided by AWS at runtime.
The problem is that when I write another lambda that tries to include my Common codes as a dependency, all of the dependencies in the dependency layer are not included. I just want to be able to build and test locally. Is there a way I can specify scope=provided only when building for actual deployment, but scope=compile when testing locally? Or maybe a totally different way of doing it?