|  |  |  | apply plugin: 'war' | 
					
						
							|  |  |  | apply plugin: 'com.google.cloud.tools.jib' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | apply from: "build-common.gradle" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | dependencies { | 
					
						
							|  |  |  | 	implementation("org.springframework.boot:spring-boot-starter-web"){ | 
					
						
							|  |  |  | 		exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat" | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | dependencies { | 
					
						
							|  |  |  | 	implementation ( | 
					
						
							|  |  |  | 		project(":io.sc.platform.app"), | 
					
						
							|  |  |  | 		project(":io.sc.platform.developer"), | 
					
						
							|  |  |  | 		project(":io.sc.platform.security.loginform"), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		project(":io.sc.engine.mv"), | 
					
						
							|  |  |  | 		project(":io.sc.engine.mv.frontend"), | 
					
						
							|  |  |  | 		project(":io.sc.engine.mv.sample"), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		project(":io.sc.engine.rule.client"), | 
					
						
							|  |  |  | 		project(":io.sc.engine.rule.client.spring"), | 
					
						
							|  |  |  | 		project(":io.sc.engine.rule.core"), | 
					
						
							|  |  |  | 		project(":io.sc.engine.rule.server"), | 
					
						
							|  |  |  | 		project(":io.sc.engine.rule.sample"), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		project(":erm"), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		project(":erm"), | 
					
						
							|  |  |  | 		project(":erm.frontend"), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //		project(":io.sc.platform.scheduler.manager"),
 | 
					
						
							|  |  |  | 	) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * replace [application.version] in i18n message file | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | processResources { | 
					
						
							|  |  |  | 	filesMatching('**/messages*.properties') { | 
					
						
							|  |  |  | 		println 'replace ${version} in [' + it + ']' | 
					
						
							|  |  |  | 		filteringCharset = 'iso8859-1' | 
					
						
							|  |  |  | 		filter(org.apache.tools.ant.filters.ReplaceTokens, beginToken: '$version', endToken: '',tokens: [version: '' + project.version]) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	doLast{ | 
					
						
							|  |  |  | 		// 为了能够兼容 eclipse 和 idea 两种开发环境,调整如下:
 | 
					
						
							|  |  |  | 		// 1. 将 environment.properties 文件放在了 src/main/resources 目录中
 | 
					
						
							|  |  |  | 		// 2. 在打包时,将该文件删除
 | 
					
						
							|  |  |  | 		delete "$buildDir/resources/main/running-mode.properties" | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bootWar{ | 
					
						
							|  |  |  | 	mainClass = "${project.name}.Application" | 
					
						
							|  |  |  | 	//launchScript()
 | 
					
						
							|  |  |  | 	manifest { | 
					
						
							|  |  |  | 		attributes  'Implementation-Version': archiveVersion, | 
					
						
							|  |  |  | 				'Implementation-Title': project.name | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bootJar{ | 
					
						
							|  |  |  | 	mainClass = "${project.name}.Application" | 
					
						
							|  |  |  | 	//launchScript()
 | 
					
						
							|  |  |  | 	manifest { | 
					
						
							|  |  |  | 		attributes  'Implementation-Version': archiveVersion, | 
					
						
							|  |  |  | 				'Implementation-Title': project.name | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | jib { | 
					
						
							|  |  |  | 	outputPaths { | 
					
						
							|  |  |  | 		tar = "build/libs/${project.name}-${project.version}-image.tar" | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	from { | 
					
						
							|  |  |  | 		image = "openjdk:8u342-slim" | 
					
						
							|  |  |  | 		//image = "eclipse-temurin:8u382-b05-jdk-focal"
 | 
					
						
							|  |  |  | 		platforms { | 
					
						
							|  |  |  | 			platform { | 
					
						
							|  |  |  | 				architecture ="arm64" | 
					
						
							|  |  |  | 				os ="linux" | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	to { | 
					
						
							|  |  |  | 		image = "${project.name}:${project.version}" | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	extraDirectories { | 
					
						
							|  |  |  | 		paths { | 
					
						
							|  |  |  | 			path { | 
					
						
							|  |  |  | 				from = "build/libs/" | 
					
						
							|  |  |  | 				into = "/opt/${project.name}/" | 
					
						
							|  |  |  | 				includes = ["${project.name}-${project.version}.war"] | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	container { | 
					
						
							|  |  |  | 		/** | 
					
						
							|  |  |  | 		 * 设置jvm的启动参数 | 
					
						
							|  |  |  | 		 * user.timezone - 解决Java程序的时区问题 | 
					
						
							|  |  |  | 		 */ | 
					
						
							|  |  |  | 		jvmFlags = ["-Duser.timezone=Asia/Shanghai"] | 
					
						
							|  |  |  | 		creationTime = "USE_CURRENT_TIMESTAMP" | 
					
						
							|  |  |  | 		ports = ["8080"] | 
					
						
							|  |  |  | 		entrypoint = [ | 
					
						
							|  |  |  | 				"java", | 
					
						
							|  |  |  | 				"-jar", | 
					
						
							|  |  |  | 				"/opt/" + project.name + "/" + project.name + "-" + project.version + ".war", | 
					
						
							|  |  |  | 				"--" + project.name + ".home.dir=" + "/opt/" + project.name | 
					
						
							|  |  |  | 		] | 
					
						
							|  |  |  | 		//entrypoint = "java -version"
 | 
					
						
							|  |  |  | 		//appRoot = "/usr/local/tomcat/webapps/ROOT"
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |