Advertisement
Guest User

Untitled

a guest
Jan 10th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 7.98 KB | None | 0 0
  1. buildscript {
  2.     repositories {
  3.         maven { url 'http://repo.spring.io/plugins-release' }
  4.     }
  5.  
  6.     dependencies {
  7.         classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0"
  8.         classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
  9.         classpath "org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE"
  10.         classpath 'com.bmuschko:gradle-cargo-plugin:2.2.3'
  11.     }
  12. }
  13.  
  14. ext {
  15.     modelMapperVersion           = '1.1.1'
  16.     lombokVersion                = '1.16.18'
  17.     springBootVersion            = '1.5.9.RELEASE'
  18.     springBootAdminVersion       = '1.5.6'
  19.     springBootLog4JVersion       = '1.3.8.RELEASE'
  20.     springDataOracleVersion      = '1.2.1.RELEASE'
  21.     oracleJdbcVersion            = '12.1.0.2'
  22.     hikariCPVersion              = '2.7.4'
  23.     junitVersion                 = '4.12'
  24.     swaggerUIVersion             = '2.7.0'
  25.     jacksonVersion               = '2.8.10'
  26.     hibernateValidatorVersion    = '5.3.6.Final'
  27. }
  28.  
  29. ext {
  30.     nexusUrl = "http://nexus.tascombank.ua"
  31.     nexusUsername = 'builder'
  32.     nexusPassword = 'Fc98F=sWLl,M'
  33. }
  34.  
  35. allprojects { p ->
  36.     group = "ua.com.tascombank"
  37.  
  38.     apply plugin: 'idea'
  39.     apply plugin: 'java'
  40.  
  41.     compileJava {
  42.         sourceCompatibility = JavaVersion.VERSION_1_8
  43.         targetCompatibility = JavaVersion.VERSION_1_8
  44.         options.encoding = 'UTF-8'
  45.     }
  46.  
  47.     compileTestJava {
  48.         sourceCompatibility = JavaVersion.VERSION_1_8
  49.         targetCompatibility = JavaVersion.VERSION_1_8
  50.         options.encoding = 'UTF-8'
  51.         options.compilerArgs += "-parameters"
  52.     }
  53.  
  54.     repositories {
  55.         maven {
  56.             url "${nexusUrl}/repository/maven-public/"
  57.         }
  58.     }
  59.  
  60.     dependencies {
  61.         compileOnly group: 'org.projectlombok', name: 'lombok', version: "${lombokVersion}"
  62.     }
  63.  
  64.     test {
  65.         enabled = false
  66.     }
  67. }
  68.  
  69. project(":core-api") {
  70.     version = "1.0.0-SNAPSHOT"
  71.  
  72. //    apply plugin: 'maven'
  73. //    apply plugin: 'com.bmuschko.nexus'
  74.     apply plugin: 'maven-publish'
  75.  
  76.     dependencies {
  77.         compileOnly group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: "${jacksonVersion}"
  78.         compileOnly group: 'org.hibernate', name: 'hibernate-validator', version: "${hibernateValidatorVersion}"
  79.     }
  80.  
  81.     task fatJar(type: Jar) {
  82.         manifest {
  83.             attributes 'Implementation-Title': 'Gradle Jar File Example',
  84.                     'Implementation-Version': version
  85. //                    'Main-Class': 'com.mkyong.DateUtils'
  86.         }
  87.         classifier = 'jar-all'
  88.         from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
  89.         with jar
  90.     }
  91.  
  92.     publishing {
  93.         publications {
  94.             maven(MavenPublication) {
  95.                 artifactId 'ekb-api'
  96.  
  97. //                from components.java
  98.                 artifact fatJar
  99. //                artifacts = [sourcesJar]
  100. //                artifact javadocJar
  101.             }
  102.         }
  103.  
  104.         repositories {
  105.             maven {
  106.                 credentials {
  107.                     username nexusUsername
  108.                     password nexusPassword
  109.                 }
  110.                 if (!project.version.endsWith('-SNAPSHOT')) {
  111.                     url "${nexusUrl}/repository/maven-releases"
  112.                 } else {
  113.                     url "${nexusUrl}/repository/maven-snapshots"
  114.                 }
  115.             }
  116.         }
  117.     }
  118.  
  119.     javadoc {
  120.         source = sourceSets.main.allJava
  121.         classpath = configurations.compileClasspath
  122.  
  123.         options {
  124.             setMemberLevel JavadocMemberLevel.PUBLIC
  125.             setAuthor true
  126.  
  127.             links "https://docs.oracle.com/javase/8/docs/api/"
  128.         }
  129.     }
  130.  
  131.     task sourcesJar(type: Jar) {
  132.         classifier = 'sources'
  133.         from sourceSets.main.allJava
  134.     }
  135.  
  136. //    task javadocJar(type: Jar) {
  137. //        from javadoc
  138. //        classifier = 'javadoc'
  139. //    }
  140.  
  141. //    artifacts {
  142. //        archives fatJar
  143. //        archives javadocJar
  144. //        archives sourcesJar
  145. //    }
  146. }
  147.  
  148. project(":core") {
  149.     def serviceName = 'ekb-service'
  150.     version = "1.0.0"
  151.  
  152.     apply plugin: 'org.springframework.boot'
  153.     apply plugin: 'war'
  154.     apply plugin: 'com.bmuschko.cargo'
  155.  
  156.     war {
  157.         doFirst {
  158.             manifest {
  159.                 attributes("Build-Version": version, "Build-Timestamp": new Date())
  160.             }
  161.         }
  162.         archiveName = "${serviceName}.war"
  163.     }
  164.  
  165.     bootRun {
  166.         // support passing -Dsystem.property=value to bootRun task
  167.         systemProperties = System.properties as Map<String, ?>
  168.     }
  169.  
  170.     bootRepackage {
  171.         mainClass = 'ua.com.tascombank.ekb.EkbService'
  172.     }
  173.  
  174.     configurations {
  175.         all*.exclude module: 'spring-boot-starter-logging'
  176.     }
  177.  
  178.     dependencies {
  179. //        compile project(":core-api")
  180.  
  181.         compile group: 'ua.com.tascombank', name: 'logger', version: "1.1.0-SNAPSHOT"
  182.         compile group: 'ua.com.tascombank', name: 'error-lib', version: "1.0.0-RELEASE"
  183.         compile group: 'ua.com.tascombank', name: 'client-lib', version: "1.0.0-RELEASE"
  184.         compile group: 'ua.com.tascombank', name: 'utils-lib', version: "1.0.0-RELEASE"
  185.         compile group: 'ua.com.tascombank', name: 'security', version: "1.8.0-RELEASE"
  186.         compile group: 'ua.com.tascombank', name: 'ekb-api', version: "1.0.0-SNAPSHOT"
  187.         compile group: 'ua.com.tascombank.statistic', name: 'security', version: "1.0-RELEASE"
  188.  
  189.         compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: "${springBootVersion}"
  190.         compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: "${springBootVersion}"
  191.         compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis', version: "${springBootVersion}"
  192.         compile group: 'org.springframework.boot', name: 'spring-boot-starter-amqp', version: "${springBootVersion}"
  193.  
  194.         compile group: 'org.springframework.boot', name: 'spring-boot-starter-log4j', version: "${springBootLog4JVersion}"
  195.  
  196.         compile group: 'de.codecentric', name: 'spring-boot-admin-starter-client', version: "${springBootAdminVersion}"
  197.         compile group: 'org.springframework.data', name: 'spring-data-oracle', version: "${springDataOracleVersion}"
  198.  
  199.         compile group: 'io.springfox', name: 'springfox-swagger2', version: "${swaggerUIVersion}"
  200.         compile group: 'io.springfox', name: 'springfox-swagger-ui', version: "${swaggerUIVersion}"
  201.         compile group: 'org.modelmapper', name: 'modelmapper', version: "${modelMapperVersion}"
  202.  
  203.         compile group: 'com.oracle', name: 'ojdbc7', version: "${oracleJdbcVersion}"
  204.         compile group: 'com.zaxxer', name: 'HikariCP', version: "${hikariCPVersion}"
  205.  
  206.         testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: "${springBootVersion}"
  207.         testCompile group: 'junit', name: 'junit', version: "${junitVersion}"
  208.     }
  209.  
  210.     cargo {
  211.         containerId = 'tomcat8x'
  212.         port = 8089
  213.  
  214.         deployable {
  215.             file = new File(getProjectDir(), "build/libs/${serviceName}.war")
  216.             context = serviceName
  217.         }
  218.  
  219.         remote {
  220.             hostname = '172.17.11.115'
  221.             username = 'deploy'
  222.             password = 'et4thu7A'
  223.         }
  224.     }
  225.  
  226. }
  227.  
  228. task wrapper(type: Wrapper) {
  229.     description = "Generates gradlew[.bat] scripts"
  230.     gradleVersion = "4.4.1"
  231.  
  232.     doLast() {
  233.         def gradleOpts = "-XX:MaxMetaspaceSize=1024m -Xmx1024m"
  234.         def gradleBatOpts = "$gradleOpts -XX:MaxHeapSize=256m"
  235.         File wrapperFile = file("gradlew")
  236.         wrapperFile.text = wrapperFile.text.replace("DEFAULT_JVM_OPTS=",
  237.                 "GRADLE_OPTS=\"$gradleOpts \$GRADLE_OPTS\"\nDEFAULT_JVM_OPTS=")
  238.         File wrapperBatFile = file("gradlew.bat")
  239.         wrapperBatFile.text = wrapperBatFile.text.replace("set DEFAULT_JVM_OPTS=",
  240.                 "set GRADLE_OPTS=$gradleBatOpts %GRADLE_OPTS%\nset DEFAULT_JVM_OPTS=")
  241.     }
  242. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement