apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' // 部署为外部服务器时, 配置为war包 apply plugin: 'war' war { archiveBaseName = 'analog-api' } // Task type of JavaCompile tasks.withType(JavaCompile, { //enable compilation in a separate daemon process sourceCompatibility = 8 targetCompatibility = 8 // default to true options.incremental = true // default to true options.failOnError = false // default to false options.fork = true options.encoding = "UTF-8" // default to true options.debug = true }) repositories { // 本地仓库 mavenLocal() // ali 代理的central仓 maven {url 'https://maven.aliyun.com/repository/central'} // ali 代理的central仓和jcenter仓的聚合仓 maven {url 'https://maven.aliyun.com/repository/public'} maven {url 'https://maven.aliyun.com/repository/google'} maven {url 'https://maven.aliyun.com/repository/gradle-plugin'} maven {url 'https://maven.aliyun.com/repository/spring'} maven {url 'https://maven.aliyun.com/repository/spring-plugin'} maven {url 'https://maven.aliyun.com/repository/grails-core'} // 远程中央仓库 mavenCentral() maven {url 'https://repo1.maven.org/maven2/'} // maven {url 'https://maven.google.com/'} maven {url 'https://plugins.gradle.org/m2/'} maven {url 'https://repo.spring.io/libs-milestone/'} maven {url 'https://repo.spring.io/plugins-release/'} maven {url 'https://repo.grails.org/grails/core/'} maven {url 'https://repository.apache.org/content/groups/public/'} maven {url 'https://repository.jboss.org/nexus/content/repositories/releases/'} // 配置使用其它nexus 私服 maven { // 非https需要增加对不安全协议的信任 allowInsecureProtocol true url 'http://nexus.ds-bay.com/content/groups/public/' credentials { username 'admin' password 'admin123' } } } ext { lombok = '1.18.22' junit = '4.13' slf4j = '1.7.25' javax_annotation_api = '1.3.2' javax_servlet = '4.0.1' spring_boot = '2.6.3' spring = '5.3.13' // logback对spring的支持 logback_ext_spring = '0.1.4' jackson = '2.11.2' // 工具类 google_guava = '29.0-jre' // Java工具包类库,各种Util工具类 hutool = '5.6.2' // (推荐)Forest,Java HTTP 客户端框架 forest = '1.5.0-RC5' // alibaba 出品 excel 工具类, 需要 lombok 支持 easyexcel = '3.0.5' } // tag::dependencies[] dependencies { compileOnly "org.projectlombok:lombok:${lombok}" annotationProcessor "org.projectlombok:lombok:${lombok}" testImplementation('org.springframework.boot:spring-boot-starter-test') { exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' } implementation "javax.annotation:javax.annotation-api:${javax_annotation_api}" // 内置Tomcat部署, 同时不需要编译, 使用 runtimeOnly //runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat' // 内置Tomcat部署, 同时需要编译, 使用 implementation implementation 'org.springframework.boot:spring-boot-starter-tomcat' // 外部Tomcat部署, 同时需要编译, 使用 compileOnly //compileOnly 'org.springframework.boot:spring-boot-starter-tomcat' //处理Properties 配置文件 //Gradle 4.5 and earlier //compileOnly 'org.springframework.boot:spring-boot-configuration-processor' //Gradle 4.6 and later annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-aop' // logback对spring的支持 implementation "org.logback-extensions:logback-ext-spring:${logback_ext_spring}" // 数据序列化 // 为保证引入 jackson包版本一致性,不使用到其它低版本包, 引入如下三个依赖 implementation "com.fasterxml.jackson.core:jackson-databind:${jackson}" implementation "com.fasterxml.jackson.core:jackson-core:${jackson}" implementation "com.fasterxml.jackson.core:jackson-annotations:${jackson}" // jackson 支持格式化LocalDateTime implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jackson}" implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:${jackson}" implementation "com.fasterxml.jackson.module:jackson-module-afterburner:${jackson}" // jackson 支持格式化XML implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jackson}" // 工具类 implementation "com.google.guava:guava:${google_guava}" // Java工具包类库,各种Util工具类 implementation "cn.hutool:hutool-all:${hutool}" // (推荐)Forest,Java HTTP 客户端框架 implementation "com.dtflys.forest:spring-boot-starter-forest:${forest}" // alibaba 出品 excel 工具类, 需要 lombok 支持 implementation "com.alibaba:easyexcel:${easyexcel}" } // end::dependencies[]