aws / aws/aws-lambda-builders

JavaGradleWorkflow fails with Gradle sub-project dependency

Offen
#217 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
maintainer/need-response type/bug
Vorherrschende Sprache
Python
Sterne
380
Forks
161
Ø Merge
1 T. 1 Std.
Gemergte PRs (30 T.)
2

Beschreibung

**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)

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit aws_lambda_builders/workflows/java_gradle/actions.py und gradle.py und konzentriere dich auf JavaGradleWorkflow:GradleBuild und den Gradle-Aufruf. Reproduziere das mit sam build für moduleB beschriebene Zwei-Modul-Setup und überprüfe anschließend, dass die gemeinsam genutzte commons.jar verfügbar ist und der SAM-Build erfolgreich abgeschlossen wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
build-system
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.