idea gradle build.gradle没有生效
intellij idea中刷新gradle无效_wulong710的专栏-CSDN博客_idea刷新build.gradle
引入插件
plugins {
id 'java'
id("war")
}
gradle抽取公共依赖到parent里
dependencies {
}
gradle引入module
dependencies {
compile project(":dubbo-api")
}
配置仓库
repositories {
mavenLocal()
mavenCentral()
}
闭包
//什么是闭包?闭包其实就是一段代码块。在gradle中,我们主要是把闭包当参数来使用
//定义一个闭包
def b1={
println "hello word"
}
//定义个方法,方法里面需要闭包类型的参数
def method1(Closure closure){
closure()
}
//调用方法method1
method1(b1)
//定义一个闭包 带参数
def b2 = {
v -> println "hello ${v}"
}
//定义方法 方法里面需要闭包类型的参数
def method2(Closure closure) {
closure("xiaomi")
}
//调用方法 method2
method2(b2)
完整的build.gradle
plugins {
id 'org.springframework.boot' version '2.3.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.macro.mall.tiny'
version = '1.0.0-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
maven { url 'https://maven.aliyun.com/repository/public' }
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-aop'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-configuration-processor'
implementation 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'com.alibaba:druid-spring-boot-starter'
implementation 'mysql:mysql-connector-java'
implementation 'io.springfox:springfox-swagger2'
implementation 'io.springfox:springfox-swagger-ui'
implementation 'io.swagger:swagger-models'
implementation 'io.swagger:swagger-annotations'
implementation 'cn.hutool:hutool-all'
implementation 'io.jsonwebtoken:jjwt'
implementation 'com.baomidou:mybatis-plus-boot-starter'
implementation 'com.baomidou:mybatis-plus-generator'
implementation 'org.apache.velocity:velocity-engine-core'
}
dependencyManagement {
dependencies {
dependency 'com.alibaba:druid-spring-boot-starter:1.1.10'
dependency 'mysql:mysql-connector-java:8.0.16'
dependency 'io.springfox:springfox-swagger2:2.9.2'
dependency 'io.springfox:springfox-swagger-ui:2.9.2'
dependency 'io.swagger:swagger-models:1.6.0'
dependency 'io.swagger:swagger-annotations:1.6.0'
dependency 'cn.hutool:hutool-all:4.5.7'
dependency 'io.jsonwebtoken:jjwt:0.9.0'
dependency 'com.baomidou:mybatis-plus-boot-starter:3.3.2'
dependency 'com.baomidou:mybatis-plus-generator:3.3.2'
dependency 'org.apache.velocity:velocity-engine-core:2.2'
}
}
test {
useJUnitPlatform()
}