Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaGradleWorkflow fails with Gradle sub-project dependency #217

Open
cts5ws opened this issue Jan 3, 2021 · 0 comments
Open

JavaGradleWorkflow fails with Gradle sub-project dependency #217

cts5ws opened this issue Jan 3, 2021 · 0 comments

Comments

@cts5ws
Copy link

cts5ws commented Jan 3, 2021

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants