Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

JavaGradleWorkflow fails with Gradle sub-project dependency

Open
#217 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
build-system

Research direction

Start with aws_lambda_builders/workflows/java_gradle/actions.py and gradle.py, focusing on JavaGradleWorkflow:GradleBuild and the Gradle invocation. Reproduce the two-module setup described with sam build on moduleB, then verify that the shared commons.jar is available and the SAM build completes successfully.

Written by the indexing model from the issue text.

Description

maintainer/need-response type/bug

Description:
I have a repo of multiple Gradle modules. One module contains all shared code, and all other modules depend on the single shared module.

Prior to moving the shared code into it's own module, sam build and deploy were working fine. Now that the module of shared code is split out, same build is failing.

Steps to reproduce the issue:

  1. Setup 2 Gradle modules(moduleA and moduleB)
  2. Let moduleB be deployed to a Lambda function and depend on moduleA
  3. Run sam build on moduleB and the build will fail

Observed result:

2021-01-03 18:50:45,589 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2021-01-03 18:50:45,716 | 'build' command is called
2021-01-03 18:50:45,720 | No Parameters detected in the template
2021-01-03 18:50:45,743 | 1 resources found in the template
2021-01-03 18:50:45,743 | Found Serverless function with name='DailyUpdateFunction' and CodeUri='.'
2021-01-03 18:50:45,744 | No Parameters detected in the template
2021-01-03 18:50:45,770 | Instantiating build definitions
2021-01-03 18:50:45,773 | Same function build definition found, adding function (Previous: BuildDefinition(java11, ., Zip, , a50fb9b9-79f6-48f1-a4dc-51818ab36e50, {}, []), Current: BuildDefinition(java11, ., Zip, , e9cb278a-418b-4322-b626-eaca6512385c, {}, []), Function: Function(name='DailyUpdateFunction', functionname='DailyUpdateFunction', runtime='java11', memory=512, timeout=20, handler='lechads.fantasybball.LambdaHandler::handleRequest', imageuri=None, packagetype='Zip', imageconfig=None, codeuri='.', environment={'Variables': {'ENV': 'PROD'}}, rolearn=None, layers=[], events={'NoonDailyUpdate': {'Type': 'Schedule', 'Properties': {'Schedule': 'cron(0, 17, *, *, ?, *)', 'Name': 'noon-daily-update', 'Enabled': True}}}, metadata=None, codesign_config_arn=None))
2021-01-03 18:50:45,774 | Building codeuri: . runtime: java11 metadata: {} functions: ['DailyUpdateFunction']
2021-01-03 18:50:45,774 | Building to following folder /Users/cschafer/Desktop/fantasy_bball_slack_integration/components/daily_update/.aws-sam/build/DailyUpdateFunction
2021-01-03 18:50:45,774 | Looking for a supported build workflow in following directories: ['/Users/cschafer/Desktop/fantasy_bball_slack_integration/components/daily_update', '/Users/cschafer/Desktop/fantasy_bball_slack_integration/components/daily_update']
2021-01-03 18:50:45,775 | Loading workflow module 'aws_lambda_builders.workflows'
2021-01-03 18:50:45,779 | Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2021-01-03 18:50:45,780 | Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
2021-01-03 18:50:45,782 | Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
2021-01-03 18:50:45,783 | Registering workflow 'GoDepBuilder' with capability 'Capability(language='go', dependency_manager='dep', application_framework=None)'
2021-01-03 18:50:45,784 | Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
2021-01-03 18:50:45,787 | Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
2021-01-03 18:50:45,790 | Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
2021-01-03 18:50:45,792 | Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
2021-01-03 18:50:45,794 | Registering workflow 'CustomMakeBuilder' with capability 'Capability(language='provided', dependency_manager=None, application_framework=None)'
2021-01-03 18:50:45,794 | Found workflow 'JavaGradleWorkflow' to support capabilities 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
2021-01-03 18:50:46,549 | Running workflow 'JavaGradleWorkflow'
2021-01-03 18:50:46,550 | Running JavaGradleWorkflow:GradleBuild
2021-01-03 18:50:56,643 | JavaGradleWorkflow:GradleBuild failed
Traceback (most recent call last):
  File "/usr/local/Cellar/aws-sam-cli/1.15.0/libexec/lib/python3.8/site-packages/aws_lambda_builders/workflows/java_gradle/actions.py", line 47, in _build_project
    self.subprocess_gradle.build(
  File "/usr/local/Cellar/aws-sam-cli/1.15.0/libexec/lib/python3.8/site-packages/aws_lambda_builders/workflows/java_gradle/gradle.py", line 45, in build
    raise GradleExecutionError(message=stderr.decode("utf8").strip())
aws_lambda_builders.workflows.java_gradle.gradle.GradleExecutionError: Gradle Failed: FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jar'.
> Cannot expand ZIP '/var/folders/90/ytzb7jbs72q6x6_zklk09tlm0000gr/T/tmpa7zgkyzw/7c0bdfb5795645b1a06a4b13758f35c5eca150e7/build/libs/commons.jar' as it does not exist.

Expected result:
Successful SAM build!!

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Reproduced this both on MacOS and Linux(Fedora)

Dominant language
Python
Stars
381
Forks
162
Avg merge
1d 1h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws/aws-lambda-builders

All issues in aws/aws-lambda-builders

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.