IDEA Gradle 打包 Spring Boot 1.5x 可运行的jar文件流程

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013474104/article/details/79425718

参考:http://blog.csdn.net/ddjjll8877/article/details/60139640

build.gradle文件:

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.10.RELEASE")
}
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'

jar {
baseName = 'gs-rest-service'
version = '0.1.0'
}

repositories {
mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.security.oauth:spring-security-oauth2")
compile("org.springframework.boot:spring-boot-starter-data-redis")
compile("org.springframework.session:spring-session")
testCompile('org.springframework.boot:spring-boot-starter-test')
compile("org.mybatis.spring.boot:mybatis-spring-boot-starter:1.3.1")
compile 'mysql:mysql-connector-java'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.46'
}

打包流程图:

陈科肇

打开Gradle窗口->找到树节点[你的项目名称]/Tasks/build/bootRepackage->双击一下,就开始编译打包jar文件了,最终会在你项目目录下的build里找到jar文件。

使用:

双击jar文件,或者java -jar **.jar

猜你喜欢

转载自blog.csdn.net/u013474104/article/details/79425718
今日推荐