You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

309 lines
11 KiB

3 years ago
  1. buildscript {
  2. repositories {
  3. mavenLocal()
  4. mavenCentral()
  5. gradlePluginPortal()
  6. maven { url "https://repo.spring.io/plugins-release" }
  7. }
  8. dependencies {
  9. //jhipster-needle-gradle-buildscript-dependency - JHipster will add additional gradle build script plugins here
  10. }
  11. }
  12. plugins {
  13. id "java"
  14. id "maven-publish"
  15. id "idea"
  16. id "jacoco"
  17. id "org.springframework.boot"
  18. id "com.google.cloud.tools.jib"
  19. id "com.gorylenko.gradle-git-properties"
  20. id "net.ltgt.apt-eclipse"
  21. id "net.ltgt.apt-idea"
  22. id "net.ltgt.apt"
  23. id "org.liquibase.gradle"
  24. id "org.sonarqube"
  25. id "io.spring.nohttp"
  26. //jhipster-needle-gradle-plugins - JHipster will add additional gradle plugins here
  27. }
  28. group = "com.cm.formationcontinue"
  29. version = "0.0.1-SNAPSHOT"
  30. description = ""
  31. sourceCompatibility=1.8
  32. targetCompatibility=1.8
  33. assert System.properties["java.specification.version"] == "1.8" || "11" || "12" || "13" || "14"
  34. apply from: "gradle/docker.gradle"
  35. apply from: "gradle/sonar.gradle"
  36. //jhipster-needle-gradle-apply-from - JHipster will add additional gradle scripts to be applied here
  37. if (project.hasProperty("prod") || project.hasProperty("gae")) {
  38. apply from: "gradle/profile_prod.gradle"
  39. } else {
  40. apply from: "gradle/profile_dev.gradle"
  41. }
  42. if (project.hasProperty("war")) {
  43. apply from: "gradle/war.gradle"
  44. }
  45. if (project.hasProperty("gae")) {
  46. apply plugin: 'maven'
  47. apply plugin: 'org.springframework.boot.experimental.thin-launcher'
  48. apply plugin: 'io.spring.dependency-management'
  49. dependencyManagement {
  50. imports {
  51. mavenBom "io.github.jhipster:jhipster-dependencies:${jhipster_dependencies_version}"
  52. }
  53. }
  54. appengineStage.dependsOn thinResolve
  55. }
  56. if (project.hasProperty("zipkin")) {
  57. apply from: "gradle/zipkin.gradle"
  58. }
  59. idea {
  60. module {
  61. excludeDirs += files("node_modules")
  62. }
  63. }
  64. eclipse {
  65. sourceSets {
  66. main {
  67. java {
  68. srcDirs += ["build/generated/sources/annotationProcessor/java/main"]
  69. }
  70. }
  71. }
  72. }
  73. defaultTasks "bootRun"
  74. springBoot {
  75. mainClassName = "com.cm.formationcontinue.FormationContinueApp"
  76. }
  77. test {
  78. useJUnitPlatform()
  79. exclude "**/*IT*", "**/*IntTest*"
  80. testLogging {
  81. events 'FAILED', 'SKIPPED'
  82. }
  83. // uncomment if the tests reports are not generated
  84. // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
  85. // ignoreFailures true
  86. reports.html.enabled = false
  87. }
  88. task integrationTest(type: Test) {
  89. useJUnitPlatform()
  90. description = "Execute integration tests."
  91. group = "verification"
  92. include "**/*IT*", "**/*IntTest*"
  93. testLogging {
  94. events 'FAILED', 'SKIPPED'
  95. }
  96. if (project.hasProperty('testcontainers')) {
  97. environment 'spring.profiles.active', 'testcontainers'
  98. }
  99. // uncomment if the tests reports are not generated
  100. // see https://github.com/jhipster/generator-jhipster/pull/2771 and https://github.com/jhipster/generator-jhipster/pull/4484
  101. // ignoreFailures true
  102. reports.html.enabled = false
  103. }
  104. check.dependsOn integrationTest
  105. task testReport(type: TestReport) {
  106. destinationDir = file("$buildDir/reports/tests")
  107. reportOn test
  108. }
  109. task integrationTestReport(type: TestReport) {
  110. destinationDir = file("$buildDir/reports/tests")
  111. reportOn integrationTest
  112. }
  113. if (!project.hasProperty("runList")) {
  114. project.ext.runList = "main"
  115. }
  116. project.ext.diffChangelogFile = "src/main/resources/config/liquibase/changelog/" + new Date().format("yyyyMMddHHmmss") + "_changelog.xml"
  117. liquibase {
  118. activities {
  119. main {
  120. driver ""
  121. url "jdbc:sqlserver://localhost:1433;database=formationContinue"
  122. username "SA"
  123. password "yourStrong(!)Password"
  124. changeLogFile "src/main/resources/config/liquibase/master.xml"
  125. defaultSchemaName ""
  126. logLevel "debug"
  127. classpath "src/main/resources/"
  128. }
  129. diffLog {
  130. driver ""
  131. url "jdbc:sqlserver://localhost:1433;database=formationContinue"
  132. username "SA"
  133. password "yourStrong(!)Password"
  134. changeLogFile project.ext.diffChangelogFile
  135. referenceUrl "hibernate:spring:com.cm.formationcontinue.domain?dialect=org.hibernate.dialect.SQLServer2012Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy"
  136. defaultSchemaName ""
  137. logLevel "debug"
  138. classpath "$buildDir/classes/java/main"
  139. }
  140. }
  141. runList = project.ext.runList
  142. }
  143. gitProperties {
  144. failOnNoGitDirectory = false
  145. keys = ["git.branch", "git.commit.id.abbrev", "git.commit.id.describe"]
  146. }
  147. checkstyle {
  148. toolVersion '${checkstyle_version}'
  149. configFile file("checkstyle.xml")
  150. checkstyleTest.enabled = false
  151. }
  152. nohttp {
  153. source.include "build.gradle", "README.md"
  154. }
  155. configurations {
  156. providedRuntime
  157. implementation.exclude module: "spring-boot-starter-tomcat"
  158. all {
  159. resolutionStrategy {
  160. // Inherited version from Spring Boot can't be used because of regressions:
  161. // To be removed as soon as spring-boot use the same version
  162. force 'org.liquibase:liquibase-core:3.9.0'
  163. }
  164. }
  165. }
  166. repositories {
  167. mavenLocal()
  168. mavenCentral()
  169. jcenter()
  170. //jhipster-needle-gradle-repositories - JHipster will add additional repositories
  171. }
  172. dependencies {
  173. // import JHipster dependencies BOM
  174. if (!project.hasProperty("gae")) {
  175. implementation platform("io.github.jhipster:jhipster-dependencies:${jhipster_dependencies_version}")
  176. }
  177. // Use ", version: jhipster_dependencies_version, changing: true" if you want
  178. // to use a SNAPSHOT release instead of a stable release
  179. implementation group: "io.github.jhipster", name: "jhipster-framework"
  180. implementation "javax.annotation:javax.annotation-api"
  181. implementation "io.dropwizard.metrics:metrics-core"
  182. implementation "io.micrometer:micrometer-registry-prometheus"
  183. implementation "net.logstash.logback:logstash-logback-encoder"
  184. implementation "com.fasterxml.jackson.datatype:jackson-datatype-hppc"
  185. implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"
  186. implementation "com.fasterxml.jackson.module:jackson-module-jaxb-annotations"
  187. implementation "com.fasterxml.jackson.datatype:jackson-datatype-hibernate5"
  188. implementation "com.fasterxml.jackson.core:jackson-annotations"
  189. implementation "com.fasterxml.jackson.core:jackson-databind"
  190. implementation "org.hibernate:hibernate-core"
  191. implementation "com.zaxxer:HikariCP"
  192. implementation "javax.transaction:javax.transaction-api"
  193. implementation "org.hibernate:hibernate-entitymanager"
  194. implementation "org.hibernate.validator:hibernate-validator"
  195. implementation "org.liquibase:liquibase-core"
  196. liquibaseRuntime "org.liquibase:liquibase-core"
  197. liquibaseRuntime "org.liquibase.ext:liquibase-hibernate5:${liquibase_hibernate5_version}"
  198. liquibaseRuntime sourceSets.main.compileClasspath
  199. implementation "org.springframework.boot:spring-boot-loader-tools"
  200. implementation "org.springframework.boot:spring-boot-starter-mail"
  201. implementation "org.springframework.boot:spring-boot-starter-logging"
  202. implementation "org.springframework.boot:spring-boot-starter-actuator"
  203. implementation "org.springframework.boot:spring-boot-starter-aop"
  204. implementation "org.springframework.boot:spring-boot-starter-data-jpa"
  205. testImplementation "org.testcontainers:mssqlserver"
  206. implementation "org.springframework.boot:spring-boot-starter-security"
  207. implementation ("org.springframework.boot:spring-boot-starter-web") {
  208. exclude module: "spring-boot-starter-tomcat"
  209. }
  210. implementation "org.springframework.boot:spring-boot-starter-undertow"
  211. implementation "org.springframework.boot:spring-boot-starter-thymeleaf"
  212. implementation "org.zalando:problem-spring-web"
  213. implementation "org.springframework.cloud:spring-cloud-starter"
  214. implementation "org.springframework.cloud:spring-cloud-starter-netflix-ribbon"
  215. implementation "org.springframework.cloud:spring-cloud-starter-netflix-hystrix"
  216. implementation "org.springframework.retry:spring-retry"
  217. implementation "org.springframework.cloud:spring-cloud-starter-netflix-eureka-client"
  218. implementation "org.springframework.cloud:spring-cloud-starter-config"
  219. implementation "org.springframework.cloud:spring-cloud-starter-openfeign"
  220. implementation "org.springframework.boot:spring-boot-starter-cloud-connectors"
  221. implementation "org.springframework.security:spring-security-config"
  222. implementation "org.springframework.security:spring-security-data"
  223. implementation "org.springframework.security:spring-security-web"
  224. implementation "io.jsonwebtoken:jjwt-api"
  225. if (!project.hasProperty("gae")) {
  226. runtimeOnly "io.jsonwebtoken:jjwt-impl"
  227. runtimeOnly "io.jsonwebtoken:jjwt-jackson"
  228. } else {
  229. implementation "io.jsonwebtoken:jjwt-impl"
  230. implementation "io.jsonwebtoken:jjwt-jackson"
  231. }
  232. implementation ("io.springfox:springfox-swagger2") {
  233. exclude module: "mapstruct"
  234. }
  235. implementation "io.springfox:springfox-bean-validators"
  236. implementation "com.microsoft.sqlserver:mssql-jdbc"
  237. implementation "com.github.sabomichal:liquibase-mssql"
  238. liquibaseRuntime "com.microsoft.sqlserver:mssql-jdbc"
  239. liquibaseRuntime "com.github.sabomichal:liquibase-mssql"
  240. implementation "org.mapstruct:mapstruct:${mapstruct_version}"
  241. annotationProcessor "org.mapstruct:mapstruct-processor:${mapstruct_version}"
  242. annotationProcessor "org.hibernate:hibernate-jpamodelgen:${hibernate_version}"
  243. annotationProcessor "org.glassfish.jaxb:jaxb-runtime:${jaxb_runtime_version}"
  244. annotationProcessor "org.springframework.boot:spring-boot-configuration-processor:${spring_boot_version}"
  245. testImplementation ("org.springframework.boot:spring-boot-starter-test") {
  246. exclude group: "org.junit.vintage", module: "junit-vintage-engine"
  247. }
  248. testImplementation "org.springframework.security:spring-security-test"
  249. testImplementation "org.springframework.boot:spring-boot-test"
  250. testImplementation "com.tngtech.archunit:archunit-junit5-api:${archunit_junit5_version}"
  251. testRuntimeOnly "com.tngtech.archunit:archunit-junit5-engine:${archunit_junit5_version}"
  252. testImplementation "com.h2database:h2"
  253. //jhipster-needle-gradle-dependency - JHipster will add additional dependencies here
  254. }
  255. if (project.hasProperty("gae")) {
  256. task createPom {
  257. def basePath = 'build/resources/main/META-INF/maven'
  258. doLast {
  259. pom {
  260. withXml(dependencyManagement.pomConfigurer)
  261. }.writeTo("${basePath}/${project.group}/${project.name}/pom.xml")
  262. }
  263. }
  264. bootJar.dependsOn = [createPom]
  265. }
  266. task cleanResources(type: Delete) {
  267. delete "build/resources"
  268. }
  269. wrapper {
  270. gradleVersion = "6.5"
  271. }
  272. compileJava.dependsOn processResources
  273. processResources.dependsOn bootBuildInfo