极简_Gradle打包SpringBoot可执行包
目标:通过命令行打包springboot项目
配置:
在项目的build.gradle脚本中添加springboot组件 如下
buildscript { repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE") } }
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
在项目根目录执行命令 gradle bootRepackage
localhost:core shawn$ gradle bootRepackage
BUILD SUCCESSFUL in 7s
5 actionable tasks: 3 executed, 2 up-to-date
在项目/build/libs下为打包完毕的jar包
执行java -jar xxx.jar 测试运行springboot应用。
至此完毕。