Spring Boot+Gradle项目打包发布

本文介绍了如何在Eclipse中创建Spring Boot项目,并通过两种方法对比,强调使用Spring插件创建项目能直接生成可运行的jar文件。通过修改build.gradle文件和运行`bootRepackage`任务,可以在buildlibs目录下得到jar,使用`java -jar`命令即可运行。

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

在Eclipse中创建Spring Boot项目有两种方法,

1. 创建一个单纯的Gradle项目,然后转换为Dynamic Web Module项目,添加SpringBoot的引用,如:

    http://blog.youkuaiyun.com/haojinming/article/details/79295255 中所示。

此时build.gradle文件如下:

/*
 * This build file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java Library project to get you started.
 * For more details take a look at the Java Libraries chapter in the Gradle
 * user guide available at https://docs.gradle.org/3.5/userguide/java_library_plugin.html
 */

// Apply the java-library plugin to add support for Java Library
apply plugin: 'java-library'

// In this section you declare where to find the dependencies of your project
repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    maven {url 'http://maven.aliyun.com/nexus/content/groups/public/'
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值