//该产品的构建基本配置,统一模板,禁止开发人员开发过程中修改。 apply plugin: "org.springframework.boot" archivesBaseName = "project-${project.name}" // 清除现有的lib目录 task clearJar(type: Delete) { delete "$buildDir\\libs\\lib" } task copyConfig(type: Copy) { from "src/main/resources/bootstrap.yml" into "$buildDir/libs/" } task copySql(type: Copy) { from "src/main/resources/sql" into "$buildDir/libs/sql" } // 将依赖包复制到lib目录 task copyJar(type: Copy, dependsOn: "clearJar") { from configurations.compileClasspath into "$buildDir\\libs\\lib" } bootJar { excludes = ["*.properties", "*.yaml", "config", "*.conf", // "*.jar" ] manifest { // attributes "Main-Class": "org.springframework.boot.loader.PropertiesLauncher" // attributes "Class-Path": configurations.compileClasspath.files.collect { "../lib/$it.name" }.join(" ") attributes "releaseVersion": version + "-" + getGitVersion() attributes "vendor": "GRIDNT山东网聪信息科技有限" attributes "buildTime": new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("GMT+08:00")) } launchScript() } dependsOn(copyConfig, copySql)