build.gradle 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. ext['log4j2.version'] = '2.17.1'
  2. buildscript {
  3. ext.'springBootVersion' = '2.7.7'
  4. repositories {
  5. mavenLocal()
  6. maven {
  7. url "https://fridaytest-maven.pkg.coding.net/repository/fridaybase/pkg01/"
  8. credentials {
  9. username = 'pkg01-1686567454885'
  10. password = 'aab1a3dd6a0db74bfb0c67b9d2f702999ef23c2a'
  11. }
  12. }
  13. }
  14. dependencies {
  15. classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
  16. classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2")
  17. }
  18. }
  19. allprojects {
  20. apply plugin: "idea"
  21. apply plugin: 'eclipse'
  22. apply plugin: 'java'
  23. apply plugin: 'org.springframework.boot'
  24. apply plugin: 'io.spring.dependency-management'
  25. apply plugin: 'maven'
  26. apply plugin: "jacoco"
  27. group = 'com.friday.blank'
  28. version = '1.0.0'
  29. sourceCompatibility = 1.8
  30. targetCompatibility = 1.8
  31. ext.'log4j2.version' = '2.16.0'
  32. idea {
  33. module {
  34. inheritOutputDirs = true
  35. }
  36. }
  37. tasks.withType(JavaCompile) {
  38. options.encoding = "UTF-8"
  39. }
  40. [compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
  41. configurations {
  42. compile.exclude module: 'spring-boot-starter-logging'
  43. }
  44. repositories {
  45. mavenLocal()
  46. maven {
  47. url "https://fridaytest-maven.pkg.coding.net/repository/fridaybase/pkg01/"
  48. credentials {
  49. username = 'pkg01-1686567454885'
  50. password = 'aab1a3dd6a0db74bfb0c67b9d2f702999ef23c2a'
  51. }
  52. }
  53. maven {
  54. url "https://fridaytest-maven.pkg.coding.net/repository/fridaymystery/pkg01/"
  55. credentials {
  56. username = 'pkg01-1687190637357'
  57. password = '92b8b418d1d7afbf4641165ce7ea1c130e3f7b16'
  58. }
  59. }
  60. maven {
  61. url "https://fridaytest-maven.pkg.coding.net/repository/fridayoperation/api/"
  62. credentials {
  63. username = 'api-1687339513221'
  64. password = 'ffc2e3f7757e4bfb73c0f59d76d10ee945ad1330'
  65. }
  66. }
  67. maven {
  68. url "https://fridaytest-maven.pkg.coding.net/repository/fridaybase/package"
  69. credentials {
  70. username = 'package-1686022569525'
  71. password = '6c814e8d1c53f904bf1014bedb626d1894066db6'
  72. }
  73. }
  74. }
  75. }
  76. subprojects {
  77. bootJar { enabled = true }
  78. jar { enabled = true }
  79. dependencies {
  80. compile('org.springframework.boot:spring-boot-starter')
  81. compile('org.yaml:snakeyaml:2.2')
  82. compile('com.fasterxml.jackson.core:jackson-databind:2.14.1')
  83. compile('org.springframework.boot:spring-boot-starter-aop')
  84. compile('org.springframework.boot:spring-boot-configuration-processor')
  85. compile('org.springframework.boot:spring-boot-starter-log4j2')
  86. compile('com.alibaba:fastjson:1.2.83')
  87. compile('io.netty:netty-all:4.1.44.Final')
  88. compile('org.apache.commons:commons-lang3:3.7')
  89. compile('com.google.guava:guava:31.1-jre')
  90. compile('com.github.ulisesbocchio:jasypt-spring-boot-starter:2.1.1')
  91. compile('log4j:log4j:1.2.17')
  92. annotationProcessor('org.projectlombok:lombok')
  93. compileOnly('org.projectlombok:lombok')
  94. }
  95. }
  96. def buildTime() {
  97. return new Date().format("yyyy-MM-dd HH:mm:ss", TimeZone.getTimeZone("GMT+08:00"))
  98. }
  99. def buildIP() {
  100. InetAddress result = null;
  101. Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
  102. while (interfaces.hasMoreElements()) {
  103. Enumeration<InetAddress> addresses = interfaces.nextElement().getInetAddresses();
  104. while (addresses.hasMoreElements()) {
  105. InetAddress address = addresses.nextElement();
  106. if (!address.isLoopbackAddress()) {
  107. if (address.isSiteLocalAddress()) {
  108. return address.getHostAddress();
  109. } else if (result == null) {
  110. result = address;
  111. }
  112. }
  113. }
  114. }
  115. return (result != null ? result : InetAddress.getLocalHost()).getHostAddress();
  116. }
  117. def gitShow() {
  118. return 'git show --stat'.execute().text.trim()
  119. }
  120. def gitUrl() {
  121. return 'git config remote.origin.url'.execute().text.trim()
  122. }
  123. def gitBranch() {
  124. return 'git symbolic-ref --short -q HEAD'.execute().text.trim()
  125. }
  126. def buildLog() {
  127. File path = new File("build/dist")
  128. if (!path.exists()) {
  129. path.mkdirs()
  130. }
  131. FileWriter fw = new FileWriter("build/dist/ibpms.RELEASE_NOTES")
  132. StringBuilder builder = new StringBuilder()
  133. builder.append("AppName: ibpms")
  134. builder.append("\r\n")
  135. builder.append("Version: $version")
  136. builder.append("\r\n")
  137. builder.append("GitUrl: " + gitUrl())
  138. builder.append("\r\n")
  139. builder.append("GitBranch: " + gitBranch())
  140. builder.append("\r\n")
  141. builder.append("Build IP: " + buildIP())
  142. builder.append("\r\n")
  143. builder.append("Build Time: " + buildTime())
  144. builder.append("\r\n")
  145. builder.append("\r\n")
  146. builder.append("*************** Git Commit Information ***************")
  147. builder.append("\r\n")
  148. builder.append(gitShow())
  149. builder.append("\r\n")
  150. builder.append("*************** Git Commit Information ***************")
  151. builder.append("\r\n")
  152. fw.write(builder.toString())
  153. fw.flush()
  154. fw.close()
  155. }