1
0

build.gradle 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. apply plugin: 'java'
  2. apply plugin: 'org.springframework.boot'
  3. apply plugin: 'io.spring.dependency-management'
  4. // 部署为外部服务器时, 配置为war包
  5. apply plugin: 'war'
  6. war {
  7. archiveBaseName = 'analog-api'
  8. }
  9. // Task type of JavaCompile
  10. tasks.withType(JavaCompile, {
  11. //enable compilation in a separate daemon process
  12. sourceCompatibility = 8
  13. targetCompatibility = 8
  14. // default to true
  15. options.incremental = true
  16. // default to true
  17. options.failOnError = false
  18. // default to false
  19. options.fork = true
  20. options.encoding = "UTF-8"
  21. // default to true
  22. options.debug = true
  23. })
  24. repositories {
  25. // 本地仓库
  26. mavenLocal()
  27. // ali 代理的central仓
  28. maven {url 'https://maven.aliyun.com/repository/central'}
  29. // ali 代理的central仓和jcenter仓的聚合仓
  30. maven {url 'https://maven.aliyun.com/repository/public'}
  31. maven {url 'https://maven.aliyun.com/repository/google'}
  32. maven {url 'https://maven.aliyun.com/repository/gradle-plugin'}
  33. maven {url 'https://maven.aliyun.com/repository/spring'}
  34. maven {url 'https://maven.aliyun.com/repository/spring-plugin'}
  35. maven {url 'https://maven.aliyun.com/repository/grails-core'}
  36. // 远程中央仓库
  37. mavenCentral()
  38. maven {url 'https://repo1.maven.org/maven2/'}
  39. // maven {url 'https://maven.google.com/'}
  40. maven {url 'https://plugins.gradle.org/m2/'}
  41. maven {url 'https://repo.spring.io/libs-milestone/'}
  42. maven {url 'https://repo.spring.io/plugins-release/'}
  43. maven {url 'https://repo.grails.org/grails/core/'}
  44. maven {url 'https://repository.apache.org/content/groups/public/'}
  45. maven {url 'https://repository.jboss.org/nexus/content/repositories/releases/'}
  46. // 配置使用其它nexus 私服
  47. maven {
  48. // 非https需要增加对不安全协议的信任
  49. allowInsecureProtocol true
  50. url 'http://nexus.ds-bay.com/content/groups/public/'
  51. credentials {
  52. username 'admin'
  53. password 'admin123'
  54. }
  55. }
  56. }
  57. ext {
  58. lombok = '1.18.22'
  59. junit = '4.13'
  60. slf4j = '1.7.25'
  61. javax_annotation_api = '1.3.2'
  62. javax_servlet = '4.0.1'
  63. spring_boot = '2.6.3'
  64. spring = '5.3.13'
  65. // logback对spring的支持
  66. logback_ext_spring = '0.1.4'
  67. jackson = '2.11.2'
  68. // 工具类
  69. google_guava = '29.0-jre'
  70. // Java工具包类库,各种Util工具类
  71. hutool = '5.6.2'
  72. // (推荐)Forest,Java HTTP 客户端框架
  73. forest = '1.5.0-RC5'
  74. // alibaba 出品 excel 工具类, 需要 lombok 支持
  75. easyexcel = '3.0.5'
  76. }
  77. // tag::dependencies[]
  78. dependencies {
  79. compileOnly "org.projectlombok:lombok:${lombok}"
  80. annotationProcessor "org.projectlombok:lombok:${lombok}"
  81. testImplementation('org.springframework.boot:spring-boot-starter-test') {
  82. exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
  83. }
  84. implementation "javax.annotation:javax.annotation-api:${javax_annotation_api}"
  85. // 内置Tomcat部署, 同时不需要编译, 使用 runtimeOnly
  86. //runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'
  87. // 内置Tomcat部署, 同时需要编译, 使用 implementation
  88. implementation 'org.springframework.boot:spring-boot-starter-tomcat'
  89. // 外部Tomcat部署, 同时需要编译, 使用 compileOnly
  90. //compileOnly 'org.springframework.boot:spring-boot-starter-tomcat'
  91. //处理Properties 配置文件
  92. //Gradle 4.5 and earlier
  93. //compileOnly 'org.springframework.boot:spring-boot-configuration-processor'
  94. //Gradle 4.6 and later
  95. annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
  96. implementation 'org.springframework.boot:spring-boot-starter-web'
  97. implementation 'org.springframework.boot:spring-boot-starter-aop'
  98. // logback对spring的支持
  99. implementation "org.logback-extensions:logback-ext-spring:${logback_ext_spring}"
  100. // 数据序列化
  101. // 为保证引入 jackson包版本一致性,不使用到其它低版本包, 引入如下三个依赖
  102. implementation "com.fasterxml.jackson.core:jackson-databind:${jackson}"
  103. implementation "com.fasterxml.jackson.core:jackson-core:${jackson}"
  104. implementation "com.fasterxml.jackson.core:jackson-annotations:${jackson}"
  105. // jackson 支持格式化LocalDateTime
  106. implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jackson}"
  107. implementation "com.fasterxml.jackson.datatype:jackson-datatype-joda:${jackson}"
  108. implementation "com.fasterxml.jackson.module:jackson-module-afterburner:${jackson}"
  109. // jackson 支持格式化XML
  110. implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${jackson}"
  111. // 工具类
  112. implementation "com.google.guava:guava:${google_guava}"
  113. // Java工具包类库,各种Util工具类
  114. implementation "cn.hutool:hutool-all:${hutool}"
  115. // (推荐)Forest,Java HTTP 客户端框架
  116. implementation "com.dtflys.forest:spring-boot-starter-forest:${forest}"
  117. // alibaba 出品 excel 工具类, 需要 lombok 支持
  118. implementation "com.alibaba:easyexcel:${easyexcel}"
  119. }
  120. // end::dependencies[]