Advertisement
Lucas_Malor

build.gradle

May 6th, 2019
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.46 KB | None | 0 0
  1. buildscript {
  2. dependencies {
  3. classpath ("org.hidetake:gradle-ssh-plugin:2.8.0")
  4. }
  5. }
  6.  
  7. plugins {
  8. id 'org.springframework.boot' version '2.1.4.RELEASE'
  9. id 'java'
  10. id 'eclipse-wtp'
  11. id "org.zeroturnaround.gradle.jrebel" version "1.1.8"
  12. }
  13.  
  14. apply plugin: 'org.hidetake.ssh'
  15. apply plugin: 'io.spring.dependency-management'
  16.  
  17. jar.dependsOn(generateRebel)
  18.  
  19. compileJava {
  20. options.encoding = 'UTF-8' //used for it.********.utility.CharUtility.escapeHTML(String)
  21. }
  22.  
  23. bootJar {
  24. launchScript()
  25. }
  26.  
  27. springBoot {
  28. buildInfo {
  29. properties {
  30. artifact = '********'
  31. version = project.hasProperty('buildversion') ? buildversion: ''
  32. group = 'it.********'
  33. name = '********'
  34. additionalProperties = [
  35. operatingSystem: "${System.properties['os.name']} (${System.properties['os.version']})",
  36. //machine: InetAddress.localHost.hostName,
  37. ]
  38. }
  39. }
  40. }
  41.  
  42. ext.jarPath = project.hasProperty('jarPath') ? "${projectDir}/${jarPath}" : "${buildDir}/libs/********.jar"
  43. ext.deployPath = project.hasProperty('deployPath') ? deployPath : '/opt/********'
  44. archivesBaseName = project.hasProperty('archives_base_name') ? archives_base_name : '********'
  45.  
  46. sourceCompatibility = 8
  47. targetCompatibility = 8
  48.  
  49. repositories {
  50. mavenCentral()
  51. maven {
  52. url "https://plugins.gradle.org/m2/"
  53. }
  54. }
  55.  
  56. dependencies {
  57. // Framework - START
  58. implementation 'org.springframework.boot:spring-boot-starter'
  59. implementation('org.springframework.boot:spring-boot-starter-data-rest')
  60. implementation('org.springframework.boot:spring-boot-starter-jdbc')
  61. implementation('org.springframework.boot:spring-boot-starter-websocket')
  62. implementation('org.springframework.boot:spring-boot-starter-mustache')
  63. implementation('com.github.sps.mustache:mustache-spring-view:1.4')
  64. implementation('org.springframework.boot:spring-boot-starter-mail')
  65. implementation('org.springframework.boot:spring-boot-starter-web-services')
  66. implementation('org.springframework.boot:spring-boot-starter-security')
  67. implementation('org.springframework.security:spring-security-ldap')
  68.  
  69. // required by LDAP
  70. implementation group: 'commons-pool', name: 'commons-pool', version: '1.6'
  71.  
  72. // required by Logback for conditional processing
  73. implementation group: 'org.codehaus.janino', name: 'janino', version: '3.0.12'
  74.  
  75. // Framework - END
  76.  
  77. // DB - START
  78. implementation files('libs/ojdbc8.jar')
  79. implementation('org.sql2o:sql2o:1.6.0-RC3')
  80. implementation('org.sql2o.extensions:sql2o-oracle:1.6.0-RC3') {
  81. exclude group:'com.oracle'
  82. }
  83. // DB - END
  84.  
  85. // Excel support - START
  86. implementation('org.apache.poi:poi:3.16')
  87. implementation('org.apache.poi:poi-ooxml:3.16') {
  88. exclude group:'stax', module: 'stax-api'
  89. }
  90. // Excel support - END
  91.  
  92. // Cerved - START
  93. implementation files('libs/CervedObject.jar')
  94. implementation files('libs/CervedWebServices.jar')
  95. implementation group: 'com.sun.xml.bind', name: 'jaxb-impl', version: '2.3.2'
  96. implementation group: 'com.sun.istack', name: 'istack-commons-runtime', version: '3.0.8'
  97. // Cerved - END
  98.  
  99. // START FLYING SAUCER
  100. implementation group: 'org.xhtmlrenderer', name: 'flying-saucer-pdf-openpdf', version: '9.1.18'
  101. implementation group: 'org.jsoup', name: 'jsoup', version: '1.11.3'
  102. // END FLYING SAUCER
  103.  
  104. // START DSS
  105. implementation('org.digidoc4j.dss:dss-pades:5.2.d4j.3')
  106. implementation group: 'org.digidoc4j.dss', name: 'dss-service', version: '5.2.d4j.3'
  107. implementation group: 'org.digidoc4j.dss', name: 'dss-token', version: '5.2.d4j.3'
  108. implementation group: 'org.digidoc4j.dss', name: 'dss-utils-apache-commons', version: '5.2.d4j.3'
  109. // END DSS
  110.  
  111. // START UNIT TEST 1
  112. testImplementation("org.springframework.boot:spring-boot-starter-test") {
  113. exclude group: 'junit', module: 'junit'
  114. }
  115. testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.2'
  116. testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.4.2'
  117. testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.2'
  118. testImplementation group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.4.2'
  119. testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.4.2'
  120. // END UNIT TEST 1
  121.  
  122. // MISCELLANEOUS - START
  123.  
  124. implementation group: 'org.iban4j', name: 'iban4j', version: '3.2.1'
  125. implementation group: 'org.hibernate', name: 'hibernate-validator', version: '6.0.8.Final'
  126. implementation 'com.opencsv:opencsv:4.0'
  127. implementation group: 'org.unbescape', name: 'unbescape', version: '1.1.6.RELEASE'
  128.  
  129. // MISCELLANEOUS - END
  130.  
  131.  
  132. /***** TOREMOVE - START *****/
  133.  
  134. // iText 5 - START
  135. implementation('com.itextpdf:itextpdf:5.5.11')
  136. implementation('com.itextpdf.tool:xmlworker:5.5.11')
  137. // iText 5 - END
  138.  
  139. implementation ('xerces:xercesImpl:2.6.2-jaxb-1.0.6') {
  140. exclude group:'xml-apis', module: 'xml-apis'
  141. }
  142.  
  143. /***** TOREMOVE - END *****/
  144. }
  145.  
  146.  
  147. // START UNIT TEST 2
  148. test {
  149. useJUnitPlatform()
  150. }
  151. test.enabled = gradle.startParameter.taskNames.contains('test') || gradle.startParameter.taskNames.contains('check')
  152. // END UNIT TEST 2
  153.  
  154. // Remote administration - START
  155.  
  156. remotes {
  157. server {
  158. host = project.hasProperty('ip') ? ip : ''
  159. user = project.hasProperty('username') ? username : '********'
  160. password = project.hasProperty('pwd') ? pwd : '********'
  161. }
  162. }
  163.  
  164. ssh.settings {
  165. logging = 'stdout'
  166. knownHosts = allowAnyHosts
  167. }
  168.  
  169. task copyjar {
  170. doLast {
  171. if (!project.hasProperty('ip')){
  172. logger.lifecycle("No IP - Launch with -Pip=xxx.xxx.xxx.xxx");
  173. throw new StopExecutionException()
  174. }
  175.  
  176. logger.lifecycle("Copying... <$jarPath to $deployPath>")
  177.  
  178. ssh.run{
  179. session(remotes.server) {
  180. put from: jarPath, into: deployPath
  181. }
  182. }
  183. }
  184. }
  185.  
  186. task stopServer {
  187. doLast {
  188. if (!project.hasProperty('ip')){
  189. logger.lifecycle("No IP - Launch with -Pip=xxx.xxx.xxx.xxx");
  190. throw new StopExecutionException()
  191. }
  192. logger.lifecycle("Execute stopServer on $remotes.server.host");
  193.  
  194. if (project.hasProperty('cmd')){
  195. cmd = project.hasProperty('cmd') ? cmd : ''
  196. ssh.run {
  197. session(remotes.server) {
  198. execute cmd
  199. }
  200. }
  201. } else {
  202. ssh.run {
  203. session(remotes.server) {
  204. execute '/etc/init.d/******** stop'
  205. }
  206. }
  207. }
  208. }
  209. }
  210.  
  211. task startServer{
  212. doLast {
  213. if (!project.hasProperty('ip')){
  214. logger.lifecycle("No IP - Launch with -Pip=xxx.xxx.xxx.xxx");
  215. throw new StopExecutionException()
  216. }
  217. logger.lifecycle("Execute stopServer on $remotes.server.host");
  218.  
  219. if (project.hasProperty('cmd')){
  220. cmd = project.hasProperty('cmd') ? cmd : ''
  221. ssh.run {
  222. session(remotes.server) {
  223. execute cmd
  224. }
  225. }
  226. } else {
  227. ssh.run {
  228. session(remotes.server) {
  229. execute '/etc/init.d/******** start'
  230. }
  231. }
  232. }
  233. }
  234. }
  235.  
  236. // Remote administration - STOP
  237.  
  238. task copyBuildFiles(type: Copy) {
  239. from file("application.properties")
  240. into ("$buildDir/libs/")
  241. }
  242.  
  243. build.dependsOn(copyBuildFiles)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement