gradle

发布时间:2024-12-12 07:36

进行Java开发,建议使用Maven或Gradle进行项目管理 #生活技巧# #工作学习技巧# #技能证书培训#

原文网址:gradle--使用Idea打包SpringBoot项目--方法/实例_IT利刃出鞘的博客-CSDN博客

简介

gradle是后端开发常用的构建工具,本文用实例介绍如何使用maven打包SpringBoot项目。

SpringBoot打包实例

代码

以Gradle创建SpringBoot项目。

项目结构

build.gradle

plugins {

id 'org.springframework.boot' version '2.3.1.RELEASE'

id 'io.spring.dependency-management' version '1.0.9.RELEASE'

id 'java'

}

group = 'com.example'

version = '0.0.1-SNAPSHOT'

sourceCompatibility = '1.8'

repositories {

mavenCentral()

}

dependencies {

implementation 'org.springframework.boot:spring-boot-starter-web'

testImplementation('org.springframework.boot:spring-boot-starter-test') {

exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'

}

}

test {

useJUnitPlatform()

}

settings.gradle

rootProject.name = 'test_springboot_gradle'

gradle命令

启动函数

package com.example.demo;

import org.springframework.boot.SpringApplication;

import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication

public class DemoApplication {

public static void main(String[] args) {

System.out.println("[DemoApplication.main]: 10");

SpringApplication.run(DemoApplication.class, args);

}

}

测试

点击Tasks=> build=> bootjar或者Tasks=> build=> build

点击bootjar:生成jar,路径:项目路径/build/libs(如下图所示)

上边是文章的部分内容,为便于维护,全文已转移到此网址:gradle-使用Idea打包SpringBoot项目-方法/实例 - 自学精灵

网址:gradle https://www.yuejiaxmz.com/news/view/450597

相关内容

gradle sync failed CreateProcess error=267 目录无效
android studio 运行优化
一个Android健身APP源码(类似KEEP、FEEL、轻+、减约、薄荷等)
Android家庭收纳APP设计与实现教程
这21个自动化部署工具,你都知道吗?
自动化测试工具下载
Android studio 中文乱码的解决办法
Attribute application@appComponentFactory value=(android
如何编写低碳环保的 Android 代码
“基于安卓平台的114生活助手系统设计与实现”

随便看看