build.gradle 4.6 KB

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