Files
will 4a53d0bb98 feat(build): 添加JVM标志配置和Java版本检查功能
- 在build.gradle中添加resolveJibJvmFlags方法支持JVM标志配置
- 在jenkins-docker-push.sh中添加JIB_JVM_FLAGS环境变量支持
- 添加JAVA_HOME环境变量配置和路径设置
- 实现Java版本检查确保使用Java 21或更高版本
- 验证Java版本并提供错误提示信息
- 导出JIB_JVM_FLAGS环境变量供构建使用
2026-08-05 20:42:56 +08:00

50 lines
1.4 KiB
Groovy

plugins {
id 'java'
id 'org.springframework.boot'
id 'io.spring.dependency-management'
id 'com.google.cloud.tools.jib'
}
bootJar {
mainClass = 'com.will.wcsApp.WcsAppApplication'
}
dependencies {
implementation project(':coreApi')
implementation project(':coreData')
implementation project(':coreAuth')
implementation project(':coreAgent')
implementation project(':businessAgent')
implementation project(':coreJob')
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.baomidou:mybatis-plus-spring-boot3-starter:3.5.14")
}
jib {
from {
image = System.getenv('JIB_BASE_IMAGE') ?: 'eclipse-temurin:21-jre'
}
to {
image = System.getenv('JIB_TARGET_IMAGE') ?: 'registry.cn-shanghai.aliyuncs.com/willhub/will-alert-server:latest'
auth {
username = System.getenv('ALIYUN_USERNAME') ?: ''
password = System.getenv('ALIYUN_PASSWORD') ?: ''
}
}
container {
mainClass = 'com.will.wcsApp.WcsAppApplication'
ports = ['8080']
environment = [TZ: 'Asia/Shanghai']
jvmFlags = resolveJibJvmFlags()
creationTime = 'USE_CURRENT_TIMESTAMP'
}
}
static List<String> resolveJibJvmFlags() {
String flags = System.getenv('JIB_JVM_FLAGS')
if (flags == null || flags.isBlank()) {
return []
}
return flags.trim().split('\\s+').findAll { it }
}