aws / aws/aws-sam-cli

Are Gradle Modules Supported?

Open
#3,227 9 comments 3 reactions 0 assignees View on GitHub
area/build area/java maintainer/need-followup stage/needs-investigation
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

I want to package and deploy a specific gradle module in my repo. The folder structure is roughly like:

```
core
| build.gradle
server
| build.gradle
lambdas
| build.gradle
build.gradle
lambdas.yml
settings.gradle
gradlew
gradlew.bat
gradle
| wrapper
```

My lambdas.yml is roughly like:

```
...

Resources:
LambdaHandler:
Type: AWS::Serverless::Function
Properties:
Runtime: java11
CodeUri: .
Handler: com.company.service.LambdaClass
...

...
```

But when I build with the SAM CLI: `sam build --template-file lambdas.yml` I get a deployment package containting only the top-level gradle dependencies, and none of my own code.

I have tried various different options, such as moving the SAM template to the `lambdas` module, changing the `CodeUri` in the SAM template, and adding `--base-dir lambdas` to the build command, but they all result in various error messages about how it can't find the gradle wrapper.

Is there any way to easily support a multi-module gradle project? I can't just add the gradle wrapper to the `lambdas` dir, because then it's no longer multi-module.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.