build.gradle 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. //---------------------- 公共部分 ----------------------//
  2. //系统启动初始化:自动下载插件
  3. def repoConfig = {
  4. all { ArtifactRepository repo ->
  5. if (repo instanceof MavenArtifactRepository) {
  6. def url = repo.url.toString()
  7. if (url.contains('repo1.maven.org/maven2')
  8. || url.contains('repo.maven.org/maven2')
  9. || url.contains('repo.maven.apache.org/maven2')
  10. || url.contains('jcenter.bintray.com')
  11. || url.contains('maven.google.com')
  12. || url.contains('plugins.gradle.org/m2')
  13. || url.contains('repo.spring.io/libs-milestone')
  14. || url.contains('repo.spring.io/plugins-release')
  15. || url.contains('repo.grails.org/grails/core')
  16. || url.contains('repository.apache.org/snapshots')
  17. ) {
  18. println "gradle init: [buildscript.repositories] (${repo.name}: ${repo.url}) removed"
  19. remove repo
  20. }
  21. }
  22. }
  23. // Maven 镜像聚合了:central、jcenter、google、gradle-plugin
  24. maven { url 'https://maven.aliyun.com/repository/central' }
  25. maven { url 'https://maven.aliyun.com/repository/jcenter' }
  26. maven { url 'https://maven.aliyun.com/repository/google' }
  27. maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
  28. maven { url 'https://maven.aliyun.com/repository/public/' }
  29. }
  30. allprojects {
  31. buildscript {
  32. repositories repoConfig
  33. }
  34. repositories repoConfig
  35. }
  36. repositories {
  37. maven {
  38. url 'https://maven.aliyun.com/repository/gradle-plugin'
  39. }
  40. }
  41. //---------------------- JAVA 编译插件 ----------------------//
  42. apply plugin: 'java-library'
  43. //JAVA 文件编码
  44. compileJava.options.encoding = 'UTF-8'
  45. tasks.withType(JavaCompile) {
  46. options.debug = true //输出行号
  47. options.debugOptions.debugLevel = "source,lines,vars" //输出行号
  48. options.encoding = "UTF-8"
  49. }
  50. //JAVA兼容性设置
  51. sourceCompatibility = '1.8'
  52. targetCompatibility = '1.8'
  53. //---------------------- 变量定义 ---------------------
  54. def ccProjectName='ccframe'
  55. def ccPubVersion='2.0-SNAPSHOT' //正式TAG版本请修改此版本号
  56. def ccReleaseTime=new Date().format("yyyy-MM-dd_HH-mm-ss", TimeZone.getTimeZone("Asia/Shanghai"))
  57. def ccBuildNumber=System.getenv().BUILD_NUMBER == null ? 'debug' : System.getenv().BUILD_NUMBER?.toInteger()
  58. def ccSvnVersion=System.getenv().SVN_REVISION == null ? 'debug' : System.getenv().SVN_REVISION?.toInteger()
  59. //---------------------- JAR 打包插件 ----------------------//
  60. apply plugin: 'application'
  61. mainClassName = 'org.ccframe.app.App'
  62. jar {
  63. manifestContentCharset 'utf-8'
  64. metadataCharset 'utf-8'
  65. manifest {
  66. attributes 'Main-Class': 'org.ccframe.app.App'
  67. }
  68. }
  69. task clearJar(type: Delete) {
  70. delete "$buildDir\\libs\\lib"
  71. }
  72. task copyJar(type: Copy, dependsOn: 'clearJar') { //提取所有的jar
  73. from configurations.compileClasspath{
  74. exclude 'lombok*'
  75. exclude 'jsp-api*'
  76. }
  77. into "$buildDir\\libs\\lib"
  78. }
  79. /*
  80. bootJar {//配合jar服务器启动.bat脚本
  81. // 例外所有的jar
  82. excludes = ["*.jar"]
  83. // lib目录的清除和复制任务
  84. dependsOn clearJar
  85. dependsOn copyJar
  86. // 指定依赖包的路径
  87. manifest {
  88. attributes "Manifest-Version": 1.0,
  89. 'Class-Path': configurations.compileClasspath.files.collect { "lib/$it.name" }.join(' ')
  90. }
  91. }
  92. //还有个https://github.com/spring-projects-experimental/spring-boot-thin-launcher有空试试
  93. */
  94. /* ----------------- buildship 整合 --------------- */
  95. apply plugin: 'java'
  96. apply plugin: 'eclipse'
  97. eclipse {
  98. classpath {
  99. downloadSources = true
  100. defaultOutputDir = file('/war/WEB-INF/classes')
  101. file {
  102. whenMerged {
  103. //兼容eclipse2020设置:test输出目录要与main的不一样
  104. entries.each {
  105. if(it.path.startsWith('src/main')){
  106. println it
  107. it.output = null
  108. }
  109. }
  110. }
  111. }
  112. }
  113. }
  114. //----------------------- 编译JAR依赖配置 ------------------------//
  115. configurations.all {
  116. transitive = false //默认不自动关联依赖,以免打包过大
  117. resolutionStrategy.cacheChangingModulesFor 0, 'seconds' //立即检查而不是要过24h,因为有snapshot
  118. exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j' // 关联发布时,强制移除冲突的jar
  119. exclude group: 'ch.qos.logback' // 关联发布时,强制移除冲突的jar
  120. exclude group: 'pull-parser'
  121. }
  122. dependencies {
  123. //参与编译与发布.
  124. implementation 'org.springframework.boot:spring-boot:2.3.2.RELEASE'
  125. implementation 'org.springframework.boot:spring-boot-starter:2.3.2.RELEASE'
  126. implementation 'org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE'
  127. implementation 'org.springframework.boot:spring-boot-autoconfigure:2.3.2.RELEASE'
  128. implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.3.2.RELEASE'
  129. implementation 'org.springframework.boot:spring-boot-starter-freemarker:2.3.2.RELEASE'
  130. implementation 'org.springframework.boot:spring-boot-starter-log4j2:2.3.2.RELEASE'
  131. implementation 'org.springframework.boot:spring-boot-starter-tomcat:2.3.2.RELEASE'
  132. implementation ('org.springframework.boot:spring-boot-starter-data-elasticsearch:2.3.2.RELEASE') {
  133. exclude group: 'org.springframework.data', module: 'spring-data-elasticsearch'
  134. }
  135. implementation 'org.springframework.boot:spring-boot-starter-security:2.3.2.RELEASE'
  136. implementation 'org.springframework.boot:spring-boot-starter-quartz:2.3.2.RELEASE'
  137. implementation 'org.springframework.boot:spring-boot-starter-actuator:2.3.2.RELEASE'
  138. // implementation 'org.springframework.boot:spring-boot-starter-data-redis-reactive:2.3.2.RELEASE'
  139. implementation 'org.apache.tomcat.embed:tomcat-embed-core:9.0.37'
  140. implementation 'org.apache.tomcat.embed:tomcat-embed-websocket:9.0.37'
  141. implementation 'javax.servlet:javax.servlet-api:4.0.1'
  142. implementation 'commons-fileupload:commons-fileupload:1.3.3'
  143. implementation 'commons-io:commons-io:2.5'
  144. implementation 'commons-jxpath:commons-jxpath:1.3'
  145. implementation 'commons-lang:commons-lang:2.6'
  146. implementation 'org.apache.commons:commons-lang3:3.11'
  147. implementation 'commons-collections:commons-collections:3.2.2'
  148. implementation 'org.apache.commons:commons-collections4:4.4'
  149. implementation 'commons-codec:commons-codec:1.15'
  150. implementation 'org.springframework:spring-core:5.2.8.RELEASE'
  151. implementation 'org.springframework:spring-beans:5.2.8.RELEASE'
  152. implementation 'org.springframework:spring-web:5.2.8.RELEASE'
  153. implementation 'org.springframework:spring-webmvc:5.2.8.RELEASE'
  154. implementation 'org.springframework:spring-context:5.2.8.RELEASE'
  155. implementation 'org.springframework:spring-context-support:5.2.8.RELEASE'
  156. implementation 'org.springframework:spring-tx:5.2.8.RELEASE'
  157. implementation 'org.springframework:spring-orm:5.2.8.RELEASE'
  158. implementation 'org.springframework:spring-aop:5.2.8.RELEASE'
  159. implementation 'org.springframework:spring-jdbc:5.2.8.RELEASE'
  160. implementation 'org.springframework:spring-expression:5.2.8.RELEASE'
  161. implementation 'org.apache.poi:poi:3.14' //3.16要commons-collection4,700多k,暂不更新
  162. implementation 'org.apache.poi:poi-ooxml:3.14'
  163. implementation 'org.apache.poi:poi-ooxml-schemas:3.14'
  164. implementation 'org.apache.poi:poi-scratchpad:3.14'
  165. implementation 'org.apache.xmlbeans:xmlbeans:3.1.0'
  166. implementation 'stax:stax-api:1.0.1'
  167. //权限认证
  168. implementation 'org.springframework.security:spring-security-config:5.3.3.RELEASE'
  169. implementation 'org.springframework.security:spring-security-core:5.3.3.RELEASE'
  170. implementation 'org.springframework.security:spring-security-web:5.3.3.RELEASE'
  171. // implementation 'org.springframework.security:spring-security-jwt:1.1.1.RELEASE'
  172. implementation 'org.springframework.data:spring-data-commons:2.2.13.RELEASE'
  173. implementation 'org.springframework.data:spring-data-jpa:2.2.13.RELEASE'
  174. implementation 'org.springframework.data:spring-data-elasticsearch:3.2.13.RELEASE' //锁定版本 https://mvnrepository.com/artifact/org.springframework.data/spring-data-releasetrain/Moore-SR13
  175. // implementation 'org.springframework.data:spring-data-redis:2.2.13.RELEASE' //lettuce驱动需要
  176. // implementation 'org.springframework.data:spring-data-keyvalue:2.2.13.RELEASE' //lettuce驱动需要
  177. implementation 'org.apache.lucene:lucene-analyzers-common:7.7.3'
  178. implementation 'org.apache.lucene:lucene-core:7.7.3'
  179. implementation 'org.apache.lucene:lucene-highlighter:7.7.3'
  180. implementation 'org.apache.lucene:lucene-join:7.7.3'
  181. implementation 'org.apache.lucene:lucene-memory:7.7.3'
  182. implementation 'org.apache.lucene:lucene-queries:7.7.3'
  183. implementation 'org.apache.lucene:lucene-queryparser:7.7.3'
  184. implementation 'org.apache.lucene:lucene-spatial:7.7.3'
  185. implementation 'org.apache.lucene:lucene-suggest:7.7.3'
  186. implementation 'org.apache.lucene:lucene-sandbox:7.7.3'
  187. implementation 'org.apache.lucene:lucene-misc:7.7.3'
  188. implementation 'org.apache.lucene:lucene-grouping:7.7.3'
  189. implementation 'joda-time:joda-time:2.9.9'
  190. implementation 'org.elasticsearch:elasticsearch-core:6.8.19'
  191. implementation 'org.elasticsearch:elasticsearch:6.8.19'
  192. implementation 'org.elasticsearch:elasticsearch-x-content:6.8.19'
  193. implementation 'org.elasticsearch.plugin:transport-netty4-client:6.8.19'
  194. implementation 'org.elasticsearch.plugin:rank-eval-client:6.8.19'
  195. implementation 'org.apache.commons:commons-pool2:2.8.0'
  196. implementation 'org.apache.httpcomponents:httpclient:4.5.12'
  197. implementation 'org.apache.httpcomponents:httpcore:4.4.13'
  198. implementation 'org.apache.httpcomponents:httpcore-nio:4.4.13'
  199. implementation 'org.apache.httpcomponents:httpasyncclient:4.1.4'
  200. //ES本地服务额外需要
  201. implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.11.0'
  202. implementation 'org.apache.logging.log4j:log4j-core:2.14.1'
  203. implementation 'org.elasticsearch:elasticsearch-cli:6.8.19'
  204. implementation 'com.tdunning:t-digest:3.2'
  205. implementation 'org.elasticsearch:jna:5.5.0'
  206. //implementation files('/lib/plugin-classloader-6.8.19.jar')
  207. //implementation 'org.codelibs.elasticsearch.lib:plugin-classloader:6.8.19'
  208. implementation 'org.codelibs.elasticsearch.lib:plugin-classloader:6.8.12'
  209. implementation 'org.hibernate:hibernate-core:5.4.19.Final'
  210. implementation 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final'
  211. implementation 'org.hibernate.common:hibernate-commons-annotations:5.1.0.Final'
  212. implementation 'net.bytebuddy:byte-buddy-dep:1.10.14'
  213. implementation 'org.ow2.asm:asm:8.0.1'
  214. implementation 'org.ow2.asm:asm-commons:8.0.1'
  215. implementation 'org.jboss:jandex:2.1.3.Final'
  216. implementation 'jakarta.persistence:jakarta.persistence-api:2.2.3'
  217. implementation 'org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE'
  218. implementation 'org.springframework.plugin:spring-plugin-metadata:1.2.0.RELEASE'
  219. // implementation 'io.lettuce:lettuce-core:5.3.1.RELEASE'
  220. // implementation 'io.netty:netty-all:4.1.50.Final'
  221. // implementation 'io.projectreactor:reactor-core:3.3.6.RELEASE'
  222. // implementation 'org.reactivestreams:reactive-streams:1.0.3'
  223. implementation 'redis.clients:jedis:2.9.3' //j2cache限制不要升级
  224. implementation 'io.netty:netty-all:4.1.50.Final'
  225. // implementation 'io.springfox:springfox-swagger-ui:2.9.2' //改用knife4j ui
  226. implementation 'io.springfox:springfox-swagger-common:2.9.2'
  227. implementation 'io.springfox:springfox-swagger2:2.9.2'
  228. implementation 'io.springfox:springfox-spring-web:2.9.2'
  229. implementation 'io.swagger:swagger-models:1.5.21'
  230. implementation 'io.swagger:swagger-annotations:1.5.21'
  231. implementation 'io.springfox:springfox-core:2.9.2'
  232. implementation 'io.springfox:springfox-spi:2.9.2'
  233. implementation 'io.springfox:springfox-schema:2.9.2'
  234. implementation 'org.mapstruct:mapstruct:1.2.0.Final'
  235. implementation 'io.github.wilson-he:swagger2-spring-boot-starter:1.1.2'
  236. implementation 'com.google.guava:failureaccess:1.0.1'
  237. implementation ('com.github.xiaoymin:knife4j-spring-boot-autoconfigure:2.0.9') {
  238. exclude group: 'com.github.xiaoymin', module: 'knife4j-spring'
  239. }
  240. implementation 'com.github.xiaoymin:knife4j-spring-ui:2.0.9'
  241. implementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.1'
  242. implementation 'org.slf4j:slf4j-api:1.7.30'
  243. implementation 'commons-logging:commons-logging:1.2'
  244. implementation 'org.apache.logging.log4j:log4j-api:2.14.1'
  245. // implementation 'org.apache.logging.log4j:log4j-core:2.14.1'
  246. implementation 'org.yaml:snakeyaml:1.26'
  247. implementation 'com.fasterxml.jackson.core:jackson-annotations:2.11.0'
  248. implementation 'com.fasterxml.jackson.core:jackson-core:2.11.0'
  249. implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.0'
  250. implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.0'
  251. implementation 'org.freemarker:freemarker:2.3.30'
  252. implementation 'com.alibaba:druid:1.1.23'
  253. implementation 'mysql:mysql-connector-java:8.0.33'
  254. implementation 'org.redisson:redisson:3.15.6' //redis分布式扩展支持
  255. implementation 'org.jboss.marshalling:jboss-marshalling:2.0.9.Final'
  256. implementation 'org.jboss.marshalling:jboss-marshalling-river:2.0.9.Final'
  257. //hanlp词法分析器 http://hanlp.linrunsoft.com/index.html
  258. implementation 'com.hankcs:hanlp:portable-1.7.1'
  259. implementation 'com.google.guava:guava:29.0-jre'
  260. implementation 'com.carrotsearch:hppc:0.8.2'
  261. implementation 'org.slf4j:jul-to-slf4j:1.7.30'
  262. implementation 'org.springframework:spring-jcl:5.2.8.RELEASE'
  263. implementation 'com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.0'
  264. implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.0'
  265. implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.0'
  266. implementation 'net.oschina.j2cache:j2cache-spring-boot2-starter:2.8.0-release'
  267. implementation 'net.oschina.j2cache:j2cache-core:2.8.2-release'
  268. implementation 'net.oschina.j2cache:j2cache-springcache:2.8.0-release'
  269. implementation 'de.ruedigermoeller:fst:2.57'
  270. implementation 'org.objenesis:objenesis:3.1'
  271. implementation 'com.github.ben-manes.caffeine:caffeine:2.8.4'
  272. implementation 'com.alibaba:fastjson:1.2.62'
  273. implementation 'com.fasterxml:classmate:1.5.1'
  274. implementation 'org.javassist:javassist:3.27.0-GA'
  275. implementation 'org.jboss.logging:jboss-logging:3.4.1.Final'
  276. implementation 'org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1.1'
  277. implementation 'org.dom4j:dom4j:2.1.3'
  278. implementation 'jakarta.annotation:jakarta.annotation-api:1.3.5'
  279. implementation 'net.coobird:thumbnailator:0.4.8'
  280. implementation 'org.dbunit:dbunit:2.5.4' //不要升级
  281. implementation 'org.apache.ant:ant:1.9.9'
  282. implementation 'antlr:antlr:2.7.7'
  283. implementation 'io.jsonwebtoken:jjwt:0.9.1' //token方案
  284. //集群定时任务
  285. implementation 'org.quartz-scheduler:quartz:2.3.2'
  286. implementation 'org.quartz-scheduler:quartz-jobs:2.3.2'
  287. implementation 'com.github.binarywang:weixin-java-miniapp:3.8.0' //微信小程序二维码支持
  288. implementation 'org.elasticsearch.client:elasticsearch-rest-high-level-client:6.8.19'
  289. implementation 'org.elasticsearch.client:elasticsearch-rest-client:6.8.19'
  290. implementation 'org.elasticsearch.plugin:lang-mustache-client:6.8.19'
  291. implementation 'uk.org.lidalia:sysout-over-slf4j:1.0.2' //system out err stacktrace转slf4j,便于统一日志
  292. //implementation 'net.logstash.logback:logstash-logback-encoder:6.4'
  293. //implementation 'org.sejda.imageio:webp-imageio:0.1.6' //webp的imageIO,用于小图
  294. implementation 'io.minio:minio:8.4.1' //minio分布式文件
  295. implementation 'com.squareup.okhttp3:okhttp:4.9.0' //minio用的http client
  296. implementation 'com.squareup.okio:okio:2.8.0' //minio用的http client
  297. implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.4.10'
  298. implementation 'org.apache.shardingsphere:sharding-jdbc-spring-boot-starter:4.1.1' //分库分表的支持
  299. implementation 'org.apache.shardingsphere:shardingsphere-common:4.1.1'
  300. implementation 'org.apache.shardingsphere:sharding-spring-boot-util:4.1.1'
  301. implementation 'org.apache.shardingsphere:sharding-transaction-spring:4.1.1'
  302. implementation 'org.apache.shardingsphere:sharding-jdbc-core:4.1.1'
  303. implementation 'org.apache.shardingsphere:shardingsphere-pluggable:4.1.1'
  304. implementation 'org.apache.shardingsphere:sharding-transaction-core:4.1.1'
  305. implementation 'org.apache.shardingsphere:shardingsphere-sql-parser-sql92:4.1.1'
  306. implementation 'org.apache.shardingsphere:shardingsphere-sql-parser-engine:4.1.1'
  307. implementation 'org.apache.shardingsphere:shardingsphere-route:4.1.1'
  308. implementation 'org.apache.shardingsphere:shardingsphere-executor:4.1.1'
  309. implementation 'org.apache.shardingsphere:shardingsphere-spi:4.1.1'
  310. implementation 'org.apache.shardingsphere:shardingsphere-sql-parser-binder:4.1.1'
  311. implementation 'org.apache.shardingsphere:shardingsphere-rewrite-engine:4.1.1'
  312. implementation 'org.apache.shardingsphere:shardingsphere-merge:4.1.1'
  313. implementation 'org.apache.shardingsphere:shardingsphere-pluggable:4.1.1'
  314. implementation 'org.apache.shardingsphere:master-slave-core-route:4.1.1'
  315. implementation 'org.apache.shardingsphere:sharding-core-common:4.1.1'
  316. implementation 'org.apache.shardingsphere:sharding-core-route:4.1.1'
  317. implementation 'org.apache.shardingsphere:sharding-core-api:4.1.1'
  318. implementation 'org.apache.shardingsphere:sharding-core-rewrite:4.1.1'
  319. implementation 'org.apache.shardingsphere:encrypt-core-rewrite:4.1.1'
  320. implementation 'org.apache.shardingsphere:encrypt-core-merge:4.1.1'
  321. implementation 'org.apache.shardingsphere:sharding-core-execute:4.1.1'
  322. implementation 'org.apache.shardingsphere:sharding-core-merge:4.1.1'
  323. implementation 'org.apache.shardingsphere:encrypt-core-common:4.1.1'
  324. implementation 'org.apache.shardingsphere:encrypt-core-api:4.1.1'
  325. implementation 'org.apache.shardingsphere:shardingsphere-sql-parser-spi:4.1.1'
  326. implementation 'org.apache.shardingsphere:shardingsphere-sql-parser-mysql:4.1.1'
  327. implementation 'org.apache.shardingsphere:shardingsphere-sql-parser-statement:4.1.1'
  328. implementation 'org.codehaus.groovy:groovy:2.4.5'
  329. implementation 'org.antlr:antlr4-runtime:4.7.2'
  330. //二维码servlet使用
  331. implementation 'com.google.zxing:core:3.4.1'
  332. implementation 'com.google.zxing:javase:3.4.1'
  333. //监控
  334. implementation 'org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.2.RELEASE'
  335. implementation 'org.latencyutils:LatencyUtils:2.0.3'
  336. implementation 'io.micrometer:micrometer-core:1.5.3'
  337. implementation 'org.springframework.boot:spring-boot-actuator:2.3.2.RELEASE'
  338. //其它编译但是不需要发布的
  339. compileOnly 'javax.servlet.jsp:jsp-api:2.2'
  340. compileOnly 'org.projectlombok:lombok:1.18.30'
  341. annotationProcessor 'org.projectlombok:lombok:1.18.30'
  342. testAnnotationProcessor 'org.projectlombok:lombok:1.18.30'
  343. //参与测试不进行发布
  344. testImplementation 'org.projectlombok:lombok:1.18.30'
  345. testImplementation 'junit:junit:4.8' //4.11的版本需要额外包
  346. }