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

本文介绍了如何使用Gradle构建工具来配置Spring Boot项目,并详细列出了build.gradle文件中的依赖项。此外,还提供了从配置到最终生成可执行jar文件的完整流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

参考:http://blog.youkuaiyun.com/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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值