build.gradle 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. ext {
  2. configuration = [
  3. javaVersion = JavaVersion.VERSION_17
  4. ]
  5. // 仓库配置
  6. repositories {
  7. mavenLocal()
  8. maven {
  9. allowInsecureProtocol = true
  10. url 'https://git.aizuda.com/api/packages/aizuda/maven'
  11. credentials(HttpHeaderCredentials) {
  12. name = "Authorization"
  13. value = "token 7d725429ef7ac5c9fa9a6779f70032d6e42d7f34"
  14. }
  15. authentication {
  16. header(HttpHeaderAuthentication)
  17. }
  18. }
  19. maven { url 'https://maven.aliyun.com/repository/central' }
  20. maven { url 'https://maven.aliyun.com/repository/spring' }
  21. maven { url 'https://maven.aliyun.com/repository/google' }
  22. maven { url 'https://repo.spring.io/release' }
  23. maven { url 'https://repo.spring.io/milestone' }
  24. mavenCentral()
  25. }
  26. }
  27. // 编译脚本
  28. buildscript {
  29. ext {
  30. springBootVersion = "3.1.1"
  31. springdocVersion = "2.5.0"
  32. mybatisPlusVersion = "3.5.9"
  33. flowlongVersion = "1.0.8"
  34. aizudaVersion = "1.0.2"
  35. }
  36. // 仓库配置
  37. repositories {
  38. mavenLocal()
  39. maven { url 'https://maven.aliyun.com/repository/central' }
  40. maven { url 'https://maven.aliyun.com/repository/spring' }
  41. maven { url 'https://maven.aliyun.com/repository/google' }
  42. maven { url 'https://repo.spring.io/release' }
  43. maven { url 'https://repo.spring.io/milestone' }
  44. mavenCentral()
  45. }
  46. dependencies {
  47. classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
  48. }
  49. }
  50. apply plugin: 'java-library'
  51. apply plugin: "io.spring.dependency-management"
  52. apply plugin: 'org.springframework.boot'
  53. group = "com.aizuda"
  54. version = "1.0"
  55. description "爱组搭低代码组件化开发平台 Spring Boot 版本"
  56. sourceCompatibility = "${javaVersion}"
  57. targetCompatibility = "${javaVersion}"
  58. tasks.withType(JavaCompile) {
  59. options.encoding = "UTF-8"
  60. }
  61. configurations {
  62. all*.exclude module: "spring-boot-starter-logging"
  63. all*.exclude module: "spring-boot-starter-tomcat"
  64. }
  65. test {
  66. useJUnitPlatform()
  67. }
  68. // 依赖管理
  69. dependencyManagement {
  70. imports {
  71. mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
  72. mavenBom "com.baomidou:mybatis-plus-bom:${mybatisPlusVersion}"
  73. mavenBom "com.aizuda:aizuda-bom:1.0.3"
  74. }
  75. }
  76. dependencies {
  77. implementation("com.aizuda:aizuda-service-parent:${aizudaVersion}") {
  78. // 纯 mysql 运行环境打开该配置排除 PG 依赖
  79. // exclude group:"org.postgresql", module:"postgresql"
  80. }
  81. // mysql 驱动,纯 PG 环境可删除该依赖
  82. implementation("mysql:mysql-connector-java:8.0.33")
  83. // ORM
  84. implementation("com.baomidou:mybatis-plus-spring-boot3-starter")
  85. implementation("com.baomidou:mybatis-plus-jsqlparser")
  86. // SSO 单点登录
  87. implementation("com.baomidou:kisso:3.9.3")
  88. // 本地缓存
  89. implementation("com.github.ben-manes.caffeine:caffeine")
  90. // 代码生成
  91. implementation("com.aizuda:aizuda-generator:${aizudaVersion}")
  92. // 日志
  93. api("org.springframework.boot:spring-boot-starter-log4j2")
  94. api("com.lmax:disruptor")
  95. // 文档 https://springdoc.org
  96. implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:${springdocVersion}")
  97. // 监控
  98. implementation("com.aizuda:aizuda-monitor")
  99. // 工作流引擎
  100. implementation("com.aizuda:flowlong-spring-boot-starter:${flowlongVersion}")
  101. // SpringBootAdmin 监控管理客户端,未使用可以删除
  102. // implementation("de.codecentric:spring-boot-admin-starter-client:3.0.2")
  103. // 电子邮件
  104. implementation("org.springframework.boot:spring-boot-starter-mail")
  105. // oss 文件存储
  106. implementation("com.aizuda:aizuda-oss")
  107. // implementation("io.minio:minio:8.5.10")
  108. implementation("com.squareup.okhttp3:okhttp:4.10.0")
  109. implementation("org.apache.tika:tika-core:2.7.0")
  110. compileOnly("p6spy:p6spy:3.9.1")
  111. testImplementation("p6spy:p6spy:3.9.1")
  112. compileOnly("org.projectlombok:lombok")
  113. annotationProcessor("org.projectlombok:lombok")
  114. testAnnotationProcessor("org.projectlombok:lombok")
  115. testCompileOnly("org.projectlombok:lombok")
  116. testImplementation("org.springframework.boot:spring-boot-starter-test")
  117. }
  118. // 执行 jar 命令编译
  119. jar {
  120. // 自定义 jar 任务以设置 MANIFEST.MF 配置分离 lib 加载
  121. manifest {
  122. attributes(
  123. 'Main-Class': 'com.aizuda.boot.BootApplication',
  124. 'Class-Path': configurations.runtimeClasspath.collect(({ "lib/${it.name}" } as Closure<Object>)).join(' ')
  125. )
  126. }
  127. }
  128. // 复制依赖到 lib 目录的任务
  129. tasks.register('copyLibs', Copy) {
  130. delete "$buildDir/libs/lib" // 删除历史包
  131. from configurations.runtimeClasspath
  132. into "$buildDir/libs/lib" // 输出到 build/libs/lib
  133. }
  134. // 仅在 jar 任务执行时,copyLibs 任务将被执行
  135. jar.finalizedBy(copyLibs)