Skip to content

Commit 0054912

Browse files
committed
Update gradle for AWS sample
1 parent e327d6e commit 0054912

File tree

4 files changed

+74
-39
lines changed

4 files changed

+74
-39
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,83 @@
1-
/*
2-
* This file was generated by the Gradle 'init' task.
3-
*/
4-
51
plugins {
6-
id 'java-library'
7-
id 'maven-publish'
2+
id 'java'
3+
id 'org.springframework.boot' version '3.2.0-M2'
4+
id 'io.spring.dependency-management' version '1.1.3'
5+
id 'com.github.johnrengelman.shadow' version '8.1.1'
6+
id 'maven-publish'
7+
id 'org.springframework.boot.experimental.thin-launcher' version "1.0.30.RELEASE"
88
}
99

10-
repositories {
11-
mavenLocal()
12-
maven {
13-
url = uri('https://repo.spring.io/snapshot')
14-
}
10+
publishing {
11+
publications {
12+
maven(MavenPublication) {
13+
from components.java
14+
versionMapping {
15+
usage('java-api') {
16+
fromResolutionOf('runtimeClasspath')
17+
}
18+
usage('java-runtime') {
19+
fromResolutionResult()
20+
}
21+
}
22+
}
23+
}
24+
}
1525

16-
maven {
17-
url = uri('https://repo.spring.io/milestone')
18-
}
26+
thinPom.mustRunAfter resolveMainClassName, test
1927

20-
maven {
21-
url = uri('https://repo.maven.apache.org/maven2/')
22-
}
28+
group = 'com.example'
29+
version = '0.0.1-SNAPSHOT'
30+
31+
java {
32+
sourceCompatibility = '17'
2333
}
2434

25-
dependencies {
26-
api 'org.springframework.cloud:spring-cloud-function-adapter-aws:4.0.3-SNAPSHOT'
27-
api 'com.amazonaws:aws-lambda-java-events:3.9.0'
28-
api 'org.springframework.boot:spring-boot-configuration-processor:3.0.5'
29-
testImplementation 'org.springframework.boot:spring-boot-starter-test:3.0.5'
30-
compileOnly 'com.amazonaws:aws-lambda-java-core:1.1.0'
35+
repositories {
36+
mavenCentral()
37+
maven { url 'https://repo.spring.io/milestone' }
38+
}
39+
40+
ext {
41+
set('springCloudVersion', "2023.0.0-M1")
3142
}
3243

33-
group = 'io.spring.sample'
34-
version = '4.0.0.RELEASE'
35-
description = 'function-sample-aws'
36-
java.sourceCompatibility = JavaVersion.VERSION_1_8
44+
assemble.dependsOn = [shadowJar, thinJar]
3745

38-
publishing {
39-
publications {
40-
maven(MavenPublication) {
41-
from(components.java)
42-
}
43-
}
46+
47+
import com.github.jengelman.gradle.plugins.shadow.transformers.*
48+
49+
shadowJar {
50+
archiveClassifier = 'aws'
51+
dependencies {
52+
exclude(
53+
dependency("org.springframework.cloud:spring-cloud-function-web:4.1.0-SNAPSHOT"))
54+
}
55+
// Required for Spring
56+
mergeServiceFiles()
57+
append 'META-INF/spring.handlers'
58+
append 'META-INF/spring.schemas'
59+
append 'META-INF/spring.tooling'
60+
append 'META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports'
61+
append 'META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports'
62+
transform(PropertiesFileTransformer) {
63+
paths = ['META-INF/spring.factories']
64+
mergeStrategy = "append"
65+
}
66+
}
67+
68+
69+
dependencies {
70+
implementation 'org.springframework.boot:spring-boot-starter'
71+
implementation 'org.springframework.cloud:spring-cloud-function-context'
72+
testImplementation 'org.springframework.boot:spring-boot-starter-test'
4473
}
4574

46-
tasks.withType(JavaCompile) {
47-
options.encoding = 'UTF-8'
75+
dependencyManagement {
76+
imports {
77+
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
78+
}
4879
}
4980

50-
tasks.withType(Javadoc) {
51-
options.encoding = 'UTF-8'
81+
tasks.named('test') {
82+
useJUnitPlatform()
5283
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

spring-cloud-function-samples/function-sample-aws/gradlew

+4-1
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,13 @@ location of your Java installation."
130130
fi
131131
else
132132
JAVACMD=java
133-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
133+
if ! command -v java >/dev/null 2>&1
134+
then
135+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134136
135137
Please set the JAVA_HOME variable in your environment to match the
136138
location of your Java installation."
139+
fi
137140
fi
138141

139142
# Increase the maximum file descriptors if we can.

0 commit comments

Comments
 (0)