Files
spring-cloud-function/spring-cloud-function-samples/function-sample-aws/build.gradle
Võ Thành Tài 8eec5a4386 Update gradle main class config
The main class is incorrect ("example.Config" does not exist), so the lambda function cannot recognize the main class of the jar file.
2022-12-22 22:23:12 +07:00

94 lines
2.6 KiB
Groovy

buildscript {
ext {
springBootVersion = '2.6.7'
wrapperVersion = '1.0.29.BUILD-SNAPSHOT'
shadowVersion = '5.1.0'
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath "com.github.jengelman.gradle.plugins:shadow:${shadowVersion}"
classpath("org.springframework.boot.experimental:spring-boot-thin-gradle-plugin:${wrapperVersion}")
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("io.spring.gradle:dependency-management-plugin:1.0.8.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.springframework.boot'
apply plugin: 'org.springframework.boot.experimental.thin-launcher'
apply plugin: 'io.spring.dependency-management'
group = 'io.spring.sample'
version = '2.0.0.RELEASE'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
ext {
springCloudFunctionVersion = "3.2.4"
awsLambdaEventsVersion = "3.9.0"
awsLambdaCoreVersion = "1.1.0"
}
ext['reactor.version'] = "3.1.7.RELEASE"
assemble.dependsOn = [shadowJar, thinJar]
jar {
manifest {
attributes 'Main-Class': 'example.FunctionConfiguration'
}
}
import com.github.jengelman.gradle.plugins.shadow.transformers.*
shadowJar {
classifier = 'aws'
dependencies {
exclude(
dependency("org.springframework.cloud:spring-cloud-function-web:${springCloudFunctionVersion}"))
}
// Required for Spring
mergeServiceFiles()
append 'META-INF/spring.handlers'
append 'META-INF/spring.schemas'
append 'META-INF/spring.tooling'
transform(PropertiesFileTransformer) {
paths = ['META-INF/spring.factories']
mergeStrategy = "append"
}
}
configurations {
testCompile.extendsFrom(compileOnly)
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-function-dependencies:${springCloudFunctionVersion}"
}
}
dependencies {
implementation("org.springframework.cloud:spring-cloud-function-adapter-aws")
implementation("org.springframework.cloud:spring-cloud-starter-function-webflux")
implementation("org.springframework.boot:spring-boot-configuration-processor")
compileOnly("com.amazonaws:aws-lambda-java-events:${awsLambdaEventsVersion}")
compileOnly("com.amazonaws:aws-lambda-java-core:${awsLambdaCoreVersion}")
testCompile('org.springframework.boot:spring-boot-starter-test')
}