GH-1108 Add gradle plugin for AWS Lambda packaging

Resolves #1108
This commit is contained in:
Oleg Zhurakousky
2023-11-20 11:22:28 +01:00
parent 9b5eaa664e
commit d5b7cb0d5a
12 changed files with 684 additions and 44 deletions

View File

@@ -1,18 +1,19 @@
plugins {
id 'java'
id 'org.springframework.cloud.function.aws-lambda.packaging' version '1.0.0'
//id 'java'
id 'org.springframework.boot' version '3.2.0-M2'
id 'io.spring.dependency-management' version '1.1.3'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'maven-publish'
id 'org.springframework.boot.experimental.thin-launcher' version "1.0.31.RELEASE"
//id 'io.spring.dependency-management' version '1.1.3'
//id 'com.github.johnrengelman.shadow' version '8.1.1'
//id 'maven-publish'
// id 'org.springframework.boot.experimental.thin-launcher' version "1.0.31.RELEASE"
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17'
}
//java {
// sourceCompatibility = '17'
//}
repositories {
mavenCentral()
@@ -24,51 +25,50 @@ ext {
set('springCloudVersion', "2023.0.0-M1")
}
assemble.dependsOn = [thinJar, shadowJar]
//assemble.dependsOn = [thinJar, shadowJar]
publishing {
publications {
maven(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
}
//publishing {
// publications {
// maven(MavenPublication) {
// from components.java
// versionMapping {
// usage('java-api') {
// fromResolutionOf('runtimeClasspath')
// }
// usage('java-runtime') {
// fromResolutionResult()
// }
// }
// }
// }
//}
shadowJar.mustRunAfter thinJar
//shadowJar.mustRunAfter thinJar
import com.github.jengelman.gradle.plugins.shadow.transformers.*
//import com.github.jengelman.gradle.plugins.shadow.transformers.*
shadowJar {
archiveClassifier = 'aws'
manifest {
inheritFrom(project.tasks.thinJar.manifest)
}
//shadowJar {
//archiveClassifier = 'aws'
//manifest {
// inheritFrom(project.tasks.thinJar.manifest)
//}
// Required for Spring
mergeServiceFiles()
append 'META-INF/spring.handlers'
append 'META-INF/spring.schemas'
append 'META-INF/spring.tooling'
append 'META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports'
append 'META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports'
transform(PropertiesFileTransformer) {
paths = ['META-INF/spring.factories']
mergeStrategy = "append"
}
}
//mergeServiceFiles()
//append 'META-INF/spring.handlers'
//append 'META-INF/spring.schemas'
//append 'META-INF/spring.tooling'
//append 'META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports'
//append 'META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports'
//transform(PropertiesFileTransformer) {
// paths = ['META-INF/spring.factories']
// mergeStrategy = "append"
//}
//}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.cloud:spring-cloud-function-adapter-aws'
implementation 'org.springframework.cloud:spring-cloud-function-context'
implementation 'org.springframework.cloud:spring-cloud-function-adapter-aws:4.1.0-SNAPSHOT'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

View File

@@ -1,5 +1,6 @@
pluginManagement {
repositories {
mavenLocal()
maven { url 'https://repo.spring.io/milestone' }
gradlePluginPortal()
}