Skip to content

Commit 622611c

Browse files
authored
chore: update gradle (#8624)
* chore: update gradle * add mount with write for java21 * fix gradle build fail * lint
1 parent 0d48873 commit 622611c

5 files changed

Lines changed: 20 additions & 9 deletions

File tree

samcli/lib/init/templates/cookiecutter-aws-sam-hello-java-gradle/{{cookiecutter.project_name}}/HelloWorldFunction/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ dependencies {
1010
implementation 'com.amazonaws:aws-lambda-java-core:1.2.0'
1111
testImplementation 'junit:junit:4.12'
1212
}
13+
14+
java {
15+
sourceCompatibility = JavaVersion.VERSION_21
16+
targetCompatibility = JavaVersion.VERSION_21
17+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

samcli/lib/init/templates/cookiecutter-aws-sam-hello-java-gradle/{{cookiecutter.project_name}}/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The Serverless Application Model Command Line Interface (SAM CLI) is an extensio
3030
To use the SAM CLI, you need the following tools.
3131

3232
* SAM CLI - [Install the SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html)
33-
* Java8 - [Install the Java SE Development Kit 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
33+
* Java21 - [Install the Java SE Development Kit 21](https://www.oracle.com/java/technologies/downloads/#java21)
3434
* Docker - [Install Docker community edition](https://hub.docker.com/search/?type=edition&offering=community)
3535

3636
To build and deploy your application for the first time, run the following in your shell:

tests/integration/buildcmd/build_integ_base.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -662,13 +662,17 @@ def _test_with_building_java(
662662
self.skipTest(self.SKIP_ARM64_EARLIER_JAVA_TESTS)
663663

664664
overrides = self.get_override(runtime, code_path, architecture, "aws.example.Hello::myHandler")
665-
mount_with = (
666-
MountMode.WRITE
667-
if use_container and str(runtime).lower() == "java25" and self.USING_MAVEN_PATH not in code_path
668-
else None
669-
)
665+
if use_container and str(runtime).lower() in ["java21", "java25"] and self.USING_MAVEN_PATH not in code_path:
666+
container_env = "GRADLE_USER_HOME=/tmp/.gradle"
667+
mount_with = MountMode.WRITE
668+
else:
669+
container_env = None
670+
mount_with = None
670671
cmdlist = self.get_command_list(
671-
use_container=use_container, parameter_overrides=overrides, mount_with=mount_with
672+
use_container=use_container,
673+
parameter_overrides=overrides,
674+
mount_with=mount_with,
675+
container_env_var=container_env,
672676
)
673677
cmdlist += ["--skip-pull-image"]
674678
if code_path == self.USING_GRADLEW_PATH and use_container and IS_WINDOWS:

tests/integration/testdata/buildcmd/Java/gradlew-in-container/21/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)