aws / aws/aws-sam-cli

Bug: gradle-8.10-bin+ causing IOException

Open
#7,864 4 comments 0 reactions 0 assignees View on GitHub
area/java stage/bug-repro
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:
When the distributionUrl in the gradle-wrapper.properties of a project is set to `https\://services.gradle.org/distributions/gradle-8.10-bin.zip` or higher versions, an IOException occurs during the build process.

### Steps to reproduce:
1.) Create a new Project in IntelliJ IDEA 2024.2.3 (Ultimate Edition)
2.) Edit the distributionUrl in the gradle-wrapper.properties from:
`https\://services.gradle.org/distributions/gradle-8.8-bin.zip`
to
`https\://services.gradle.org/distributions/gradle-8.10-bin.zip`
3.) Add `implementation("com.amazonaws:aws-lambda-java-core:1.2.3")` to the dependencies
4.) Use the following class class/code and run the local webhook
```
public class LambraEntryPoint implements RequestStreamHandler {

/**
* Handles a Lambda Function request
*
* @param input The Lambda Function input stream
* @param output The Lambda function output stream
* @param context The Lambda execution environment context object.
*/
@Override
public void handleRequest(InputStream input, OutputStream output, Context context) throws IOException {
}
}

```

### Observed result:
Result was tested on gradle-8.8-bin.zip and gradle-8.12.1-bin.zip
```
2025-02-05 11:32:34,658 | Running workflow 'JavaGradleWorkflow'
2025-02-05 11:32:34,658 | Running JavaGradleWorkflow:GradleBuild
2025-02-05 11:32:35,619 | JavaGradleWorkflow:GradleBuild failed
Traceback (most recent call last):
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\site-packages\aws_lambda_builders\workflows\java_gradle\actions.py", line 50, in _build_project
self.subprocess_gradle.build(
File "C:\Program Files\Amazon\AWSSAMCLI\runtime\Lib\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:
Gradle could not start your build.
> Could not create service of type BuildLifecycleController using ServicesProvider.createBuildLifecycleController().
> Could not create service of type BuildModelController using VintageBuildControllerProvider.createBuildModelController().
> Could not create service of type OutputFilesRepository using ExecutionBuildServices.createOutputFilesRepository().
> java.io.IOException: Cannot delete file: C:\Users\USER~1\AppData\Local\Temp\tmp83ub653u\gradle-cache\buildOutputCleanup\buildOutputCleanup.lock
```

### Expected result:
Build Succeeded

### Additional environment details:

1. OS: Win 11
2. `sam --version`: SAM CLI, version 1.132.0
3. AWS region: Frankfurt (eu-central-1)

```
{
"version": "1.132.0",
"system": {
"python": "3.12.6",
"os": "Windows-11-10.0.22631-SP0"
},
"additional_dependencies": {
"docker_engine": "24.0.6",
"aws_cdk": "Not available",
"terraform": "Not available"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}

```

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.