build.gradle 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. buildscript {
  2. repositories {
  3. maven { url 'https://maven.aliyun.com/repository/public' }
  4. gradlePluginPortal()
  5. }
  6. dependencies {
  7. //jhipster-needle-gradle-buildscript-dependency - JHipster will add additional gradle build script plugins here
  8. }
  9. }
  10. plugins {
  11. id "java"
  12. id "maven-publish"
  13. id "idea"
  14. id "eclipse"
  15. id "jacoco"
  16. id "org.springframework.boot"
  17. id "com.google.cloud.tools.jib"
  18. id "com.gorylenko.gradle-git-properties"
  19. id "org.liquibase.gradle"
  20. id "org.sonarqube"
  21. id "io.spring.nohttp"
  22. id "com.github.andygoossens.gradle-modernizer-plugin"
  23. //jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here
  24. id "org.springframework.boot.experimental.thin-launcher" version "1.0.28.RELEASE" apply false
  25. id "io.spring.dependency-management" version "1.0.11.RELEASE" apply false
  26. }
  27. group = "com.ruowei"
  28. version = ""
  29. description = ""
  30. sourceCompatibility = 11
  31. targetCompatibility = 11
  32. assert System.properties["java.specification.version"] == "11" || "12" || "13" || "14" || "15" || "16" || "17"
  33. apply from: "gradle/docker.gradle"
  34. apply from: "gradle/sonar.gradle"
  35. //jhipster-needle-gradle-apply-from - JHipster will add additional gradle scripts to be applied here
  36. if (project.hasProperty("prod") || project.hasProperty("gae")) {
  37. apply from: "gradle/profile_prod.gradle"
  38. } else {
  39. apply from: "gradle/profile_dev.gradle"
  40. }
  41. if (project.hasProperty("war")) {
  42. apply from: "gradle/war.gradle"
  43. }
  44. if (project.hasProperty("gae")) {
  45. apply plugin: 'maven'
  46. apply plugin: 'org.springframework.boot.experimental.thin-launcher'
  47. apply plugin: 'io.spring.dependency-management'
  48. dependencyManagement {
  49. imports {
  50. mavenBom "tech.jhipster:jhipster-dependencies:${jhipsterDependenciesVersion}"
  51. }
  52. }
  53. appengineStage.dependsOn thinResolve
  54. }
  55. if (project.hasProperty("zipkin")) {
  56. apply from: "gradle/zipkin.gradle"
  57. }
  58. if (project.hasProperty("thin")) {
  59. apply from: "gradle/thin.gradle"
  60. bootJarMainClassName.dependsOn thinPom
  61. }
  62. idea {
  63. module {
  64. excludeDirs += files("node_modules")
  65. }
  66. }
  67. eclipse {
  68. sourceSets {
  69. main {
  70. java {
  71. srcDirs += ["build/generated/sources/annotationProcessor/java/main"]
  72. }
  73. }
  74. }
  75. }
  76. defaultTasks "bootRun"
  77. springBoot {
  78. // mainClassName = "com.ruowei.CnspJavaApp"
  79. mainClass = 'com.ruowei.CnspJavaApp'
  80. }
  81. test {
  82. useJUnitPlatform()
  83. exclude "**/*IT*", "**/*IntTest*"
  84. exclude '**/*IntegrationTest*'
  85. testLogging {
  86. events 'FAILED', 'SKIPPED'
  87. }
  88. jvmArgs += '-Djava.security.egd=file:/dev/./urandom -Xmx256m'
  89. // uncomment if the tests reports are not generated
  90. // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
  91. // ignoreFailures true
  92. reports.html.enabled = false
  93. }
  94. modernizer {
  95. failOnViolations = true
  96. includeTestClasses = true
  97. }
  98. task integrationTest(type: Test) {
  99. useJUnitPlatform()
  100. description = "Execute integration tests."
  101. group = "verification"
  102. include "**/*IT*", "**/*IntTest*"
  103. testLogging {
  104. events 'FAILED', 'SKIPPED'
  105. }
  106. jvmArgs += '-Djava.security.egd=file:/dev/./urandom -Xmx256m'
  107. if (project.hasProperty('testcontainers')) {
  108. environment 'spring.profiles.active', 'testcontainers'
  109. }
  110. // uncomment if the tests reports are not generated
  111. // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
  112. // ignoreFailures true
  113. reports.html.enabled = false
  114. }
  115. check.dependsOn integrationTest
  116. task testReport(type: TestReport) {
  117. destinationDir = file("$buildDir/reports/tests")
  118. reportOn test
  119. }
  120. task integrationTestReport(type: TestReport) {
  121. destinationDir = file("$buildDir/reports/tests")
  122. reportOn integrationTest
  123. }
  124. if (!project.hasProperty("runList")) {
  125. project.ext.runList = "main"
  126. }
  127. project.ext.diffChangelogFile = "src/main/resources/config/liquibase/changelog/" + new Date().format("yyyyMMddHHmmss") + "_changelog.xml"
  128. liquibase {
  129. activities {
  130. main {
  131. driver "com.mysql.cj.jdbc.Driver"
  132. url "jdbc:mysql://localhost:3306/cnspJava"
  133. username "root"
  134. password ""
  135. changeLogFile "src/main/resources/config/liquibase/master.xml"
  136. defaultSchemaName "cnspJava"
  137. logLevel "debug"
  138. classpath "src/main/resources/"
  139. }
  140. diffLog {
  141. driver "com.mysql.cj.jdbc.Driver"
  142. url "jdbc:mysql://localhost:3306/cnspJava"
  143. username "root"
  144. password ""
  145. changeLogFile project.ext.diffChangelogFile
  146. referenceUrl "hibernate:spring:com.ruowei.domain?dialect=org.hibernate.dialect.MySQL8Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
  147. defaultSchemaName "cnspJava"
  148. logLevel "debug"
  149. classpath "$buildDir/classes/java/main"
  150. }
  151. }
  152. runList = project.ext.runList
  153. }
  154. gitProperties {
  155. failOnNoGitDirectory = false
  156. keys = ["git.branch", "git.commit.id.abbrev", "git.commit.id.describe"]
  157. }
  158. checkstyle {
  159. toolVersion "${checkstyleVersion}"
  160. configFile file("checkstyle.xml")
  161. checkstyleTest.enabled = false
  162. }
  163. nohttp {
  164. source.include "build.gradle", "README.md"
  165. }
  166. configurations {
  167. providedRuntime
  168. implementation.exclude module: "spring-boot-starter-tomcat"
  169. all {
  170. resolutionStrategy {
  171. // Inherited version from Spring Boot can't be used because of regressions:
  172. // To be removed as soon as spring-boot use the same version
  173. force 'org.liquibase:liquibase-core:4.6.1'
  174. }
  175. }
  176. }
  177. repositories {
  178. mavenLocal()
  179. maven { url 'https://maven.aliyun.com/repository/public' }
  180. mavenCentral()
  181. //jhipster-needle-gradle-repositories - JHipster will add additional repositories
  182. }
  183. dependencies {
  184. // import JHipster dependencies BOM
  185. if (!project.hasProperty("gae")) {
  186. implementation platform("tech.jhipster:jhipster-dependencies:${jhipsterDependenciesVersion}")
  187. }
  188. // Use ", version: jhipsterDependenciesVersion, changing: true" if you want
  189. // to use a SNAPSHOT release instead of a stable release
  190. implementation group: "tech.jhipster", name: "jhipster-framework"
  191. implementation "javax.annotation:javax.annotation-api"
  192. implementation "org.springframework.boot:spring-boot-starter-cache"
  193. implementation "io.dropwizard.metrics:metrics-core"
  194. implementation "io.micrometer:micrometer-registry-prometheus"
  195. implementation "com.fasterxml.jackson.datatype:jackson-datatype-hppc"
  196. implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
  197. implementation "com.fasterxml.jackson.module:jackson-module-jaxb-annotations"
  198. implementation "com.fasterxml.jackson.datatype:jackson-datatype-hibernate5"
  199. implementation "com.fasterxml.jackson.core:jackson-annotations"
  200. implementation "com.fasterxml.jackson.core:jackson-databind"
  201. implementation "javax.cache:cache-api"
  202. implementation "org.hibernate:hibernate-core"
  203. implementation "com.zaxxer:HikariCP"
  204. implementation "org.apache.commons:commons-lang3"
  205. implementation "javax.transaction:javax.transaction-api"
  206. implementation "com.github.ben-manes.caffeine:caffeine:${caffeineVersion}"
  207. implementation "com.github.ben-manes.caffeine:jcache:${caffeineVersion}"
  208. implementation "com.typesafe:config:${typesafeConfigVersion}"
  209. implementation "org.hibernate:hibernate-jcache"
  210. implementation "org.hibernate:hibernate-entitymanager"
  211. implementation "org.hibernate.validator:hibernate-validator"
  212. implementation "org.liquibase:liquibase-core"
  213. liquibaseRuntime "org.liquibase:liquibase-core"
  214. liquibaseRuntime "org.liquibase.ext:liquibase-hibernate5:${liquibaseHibernate5Version}"
  215. liquibaseRuntime sourceSets.main.compileClasspath
  216. implementation "org.springframework.boot:spring-boot-loader-tools"
  217. implementation "org.springframework.boot:spring-boot-starter-mail"
  218. implementation "org.springframework.boot:spring-boot-starter-logging"
  219. implementation "org.springframework.boot:spring-boot-starter-actuator"
  220. implementation "org.springframework.boot:spring-boot-starter-data-jpa"
  221. testImplementation "org.testcontainers:mysql"
  222. implementation "org.springframework.boot:spring-boot-starter-security"
  223. implementation("org.springframework.boot:spring-boot-starter-web") {
  224. exclude module: "spring-boot-starter-tomcat"
  225. }
  226. implementation "org.springframework.boot:spring-boot-starter-undertow"
  227. implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
  228. implementation "org.zalando:problem-spring-web"
  229. implementation "org.springframework.security:spring-security-config"
  230. implementation "org.springframework.security:spring-security-data"
  231. implementation "org.springframework.security:spring-security-web"
  232. implementation "io.jsonwebtoken:jjwt-api"
  233. if (!project.hasProperty("gae")) {
  234. runtimeOnly "io.jsonwebtoken:jjwt-impl"
  235. runtimeOnly "io.jsonwebtoken:jjwt-jackson"
  236. } else {
  237. implementation "io.jsonwebtoken:jjwt-impl"
  238. implementation "io.jsonwebtoken:jjwt-jackson"
  239. }
  240. // implementation("io.springfox:springfox-oas")
  241. // https://mvnrepository.com/artifact/io.springfox/springfox-oas
  242. implementation 'io.springfox:springfox-oas:3.0.0'
  243. // implementation("io.springfox:springfox-swagger2")
  244. // https://mvnrepository.com/artifact/io.springfox/springfox-swagger2
  245. implementation 'io.springfox:springfox-swagger2:3.0.0'
  246. // implementation "io.springfox:springfox-bean-validators"
  247. // https://mvnrepository.com/artifact/io.springfox/springfox-bean-validators
  248. implementation 'io.springfox:springfox-bean-validators:3.0.0'
  249. implementation "mysql:mysql-connector-java"
  250. liquibaseRuntime "mysql:mysql-connector-java"
  251. implementation "org.mapstruct:mapstruct:${mapstructVersion}"
  252. annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}"
  253. annotationProcessor "org.hibernate:hibernate-jpamodelgen:${hibernateVersion}"
  254. annotationProcessor "org.glassfish.jaxb:jaxb-runtime:${jaxbRuntimeVersion}"
  255. annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:${springBootVersion}"
  256. testImplementation "org.springframework.boot:spring-boot-starter-test"
  257. testImplementation "org.springframework.security:spring-security-test"
  258. testImplementation "org.springframework.boot:spring-boot-test"
  259. testImplementation "com.tngtech.archunit:archunit-junit5-api:${archunitJunit5Version}"
  260. testRuntimeOnly "com.tngtech.archunit:archunit-junit5-engine:${archunitJunit5Version}"
  261. testImplementation "com.h2database:h2"
  262. developmentOnly "org.springframework.boot:spring-boot-devtools:${springBootVersion}"
  263. //jhipster-needle-gradle-dependency - JHipster will add additional dependencies here
  264. compileOnly "org.projectlombok:lombok:1.18.22"
  265. annotationProcessor "org.projectlombok:lombok:1.18.22"
  266. implementation "com.querydsl:querydsl-core:5.0.0"
  267. implementation "com.querydsl:querydsl-jpa:5.0.0"
  268. annotationProcessor "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"
  269. annotationProcessor "com.querydsl:querydsl-apt:5.0.0:jpa"
  270. implementation "com.github.xiaoymin:knife4j-spring-ui:3.0.3"
  271. implementation "org.springframework.boot:spring-boot-starter-webflux"
  272. // https://mvnrepository.com/artifact/org.apache.poi/poi
  273. implementation group: 'org.apache.poi', name: 'poi', version: '4.1.2'
  274. // https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml
  275. implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.2'
  276. // https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas
  277. implementation group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '4.1.2'
  278. // https://mvnrepository.com/artifact/com.itextpdf/itextpdf
  279. implementation group: 'com.itextpdf', name: 'itextpdf', version: '5.5.13.2'
  280. // https://mvnrepository.com/artifact/com.itextpdf/io
  281. implementation group: 'com.itextpdf', name: 'io', version: '7.1.4'
  282. // https://mvnrepository.com/artifact/com.itextpdf/itext-asian
  283. implementation group: 'com.itextpdf', name: 'itext-asian', version: '5.2.0'
  284. // crawl
  285. implementation group: 'edu.uci.ics', name: 'crawler4j', version: '4.4.0'
  286. // jsoup
  287. implementation group: 'org.jsoup', name: 'jsoup', version: '1.11.3'
  288. // ali-fastjson
  289. // implementation group: 'com.alibaba', name: 'fastjson', version: '1.2.75'
  290. // https://mvnrepository.com/artifact/com.alibaba.fastjson2/fastjson2
  291. implementation group: 'com.alibaba.fastjson2', name: 'fastjson2', version: '2.0.25'
  292. implementation "com.github.yitter:yitter-idgenerator:1.0.6"
  293. implementation "org.mariuszgromada.math:MathParser.org-mXparser:4.4.2"
  294. // https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox
  295. implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: '1.7.1'
  296. // https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core
  297. implementation group: 'com.aliyun', name: 'aliyun-java-sdk-core', version: '4.5.18'
  298. implementation('org.modelmapper:modelmapper:2.3.9')
  299. // pinyin
  300. implementation 'com.belerweb:pinyin4j:2.5.0'
  301. }
  302. if (project.hasProperty("gae")) {
  303. task createPom {
  304. def basePath = 'build/resources/main/META-INF/maven'
  305. doLast {
  306. pom {
  307. withXml(dependencyManagement.pomConfigurer)
  308. }.writeTo("${basePath}/${project.group}/${project.name}/pom.xml")
  309. }
  310. }
  311. bootJar.dependsOn = [createPom]
  312. }
  313. task cleanResources(type: Delete) {
  314. delete "build/resources"
  315. }
  316. tasks.named("integrationTest").configure {
  317. enabled = false
  318. }
  319. tasks.named("checkstyleMain").configure {
  320. enabled = false
  321. }
  322. tasks.named("test").configure {
  323. enabled = false
  324. }
  325. wrapper {
  326. // gradleVersion = "7.0.2"
  327. gradleVersion = "7.4.2"
  328. }
  329. compileJava.dependsOn processResources
  330. processResources.dependsOn bootBuildInfo