使用Gradle创建springcloud项目


第一步新建项目,这都不用说了,有手就行

 

 第二步选中SpringInitalizr  Project SDK 是项目使用的jdk版本 直接引入就可以了

 

 Group

 

选你需要的依赖,无所谓,你也可以什么都不选,到时候再maven库找你需要的就行了

 

 


这就不再是想maven的pom文件了,这个是要在build.gradle中了
plugins {
id 'org.springframework.boot' version '2.3.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}

version = '0.0.1-SNAPSHOT'

subprojects {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
sourceCompatibility = '11'
targetCompatibility = '11'
repositories {
maven{
url="http://maven.aliyun.com/nexus/content/repositories/central/"
}
}

ext {
set('springCloudAlibabaVersion', "2.2.1.RELEASE")
set('springCloudVersion', "Hoxton.SR4")
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter'
implementation 'org.springframework.cloud:spring-cloud-starter-security'
compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-oauth2', version: '2.2.4.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
compile group: 'cn.hutool', name: 'hutool-all', version: '5.4.1'
compile group: 'com.alibaba', name: 'fastjson', version: '1.2.73'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
}

dependencyManagement {
imports {
mavenBom "com.alibaba.cloud:spring-cloud-alibaba-dependencies:${springCloudAlibabaVersion}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

test {
useJUnitPlatform()
}

}
其他应该没了,我缺了什么,留言告诉我


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM