Advertisement
Guest User

Micronaut build file

a guest
Oct 1st, 2019
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 3.90 KB | None | 0 0
  1. plugins {
  2.     id "com.github.johnrengelman.shadow" version "5.0.0"
  3.     id "application"
  4.     id "org.liquibase.gradle" version "2.0.0"
  5.     id "java"
  6.     id "nu.studer.jooq" version "3.0.3"
  7. }
  8.  
  9. group 'com.mycompany'
  10. version '1.0'
  11.  
  12. sourceCompatibility = 1.11
  13. targetCompatibility = 1.11
  14.  
  15. repositories {
  16.     mavenCentral()
  17. }
  18.  
  19. dependencies {
  20.     annotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
  21.     annotationProcessor "io.micronaut:micronaut-inject-java"
  22.     annotationProcessor "io.micronaut:micronaut-validation"
  23.     implementation platform("io.micronaut:micronaut-bom:$micronautVersion")
  24.     implementation "io.micronaut:micronaut-http-client"
  25.     implementation "io.micronaut:micronaut-inject"
  26.     implementation "io.micronaut:micronaut-validation"
  27.     implementation "io.micronaut:micronaut-runtime"
  28.     implementation "io.micronaut:micronaut-http-server-netty"
  29.     implementation 'com.google.code.gson:gson:2.8.5'
  30.     implementation 'io.micronaut.configuration:micronaut-jooq'
  31.     implementation 'io.micronaut:micronaut-management:1.1.0'
  32.     runtime 'org.postgresql:postgresql:42.2.4'
  33.     runtimeOnly "ch.qos.logback:logback-classic:1.2.3"
  34.     testAnnotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
  35.     testAnnotationProcessor "io.micronaut:micronaut-inject-java"
  36.     testImplementation platform("io.micronaut:micronaut-bom:$micronautVersion")
  37.     testImplementation "org.junit.jupiter:junit-jupiter-api"
  38.     testImplementation "io.micronaut.test:micronaut-test-junit5"
  39.     testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"
  40.    
  41.     jooqRuntime 'postgresql:postgresql:9.1-901.jdbc4'
  42.  
  43.     liquibaseRuntime("org.liquibase:liquibase-core:3.6.1")
  44.     liquibaseRuntime('org.postgresql:postgresql:42.2.4')
  45. }
  46.  
  47. test.classpath += configurations.developmentOnly
  48.  
  49. mainClassName = "com.mycompany.Application"
  50.  
  51. // use JUnit 5 platform
  52. test {
  53.     useJUnitPlatform()
  54. }
  55.  
  56. tasks.withType(JavaCompile){
  57.     options.encoding = "UTF-8"
  58.     options.compilerArgs.add('-parameters')
  59. }
  60.  
  61. // Database setup
  62. project.ext {
  63.     name = "my-app"
  64.     ciCommitSha = ""
  65.     dbUrl = "jdbc:postgresql://localhost:5432/my_app"
  66.     username = "username"
  67.     password = "password"
  68. }
  69.  
  70. def generatedDir = 'src/main/generated'
  71. sourceSets {
  72.     main {
  73.         java {
  74.             srcDirs += [generatedDir]
  75.         }
  76.     }
  77. }
  78.  
  79. jooq {
  80.     Postgres(sourceSets.main) {
  81.         jdbc {
  82.             driver = 'org.postgresql.Driver'
  83.             url = project.ext.dbUrl
  84.             user = project.ext.username
  85.             password = project.ext.password
  86.             schema = 'my_app'
  87.         }
  88.         generator {
  89.             name = 'org.jooq.codegen.DefaultGenerator'
  90.             strategy {
  91.                 name = 'org.jooq.codegen.DefaultGeneratorStrategy'
  92.             }
  93.             database {
  94.                 name = 'org.jooq.meta.postgres.PostgresDatabase'
  95.                 inputSchema = 'public'
  96.                 forcedTypes {
  97.                     forcedType {
  98.                         userType = 'com.google.gson.JsonElement'
  99.                         binding = 'com.mycompany.util.PostgresJSONGsonBinding'
  100.                         expression = '.*'
  101.                         types = 'JSONB?'
  102.                     }
  103.                 }
  104.             }
  105.             generate {
  106.                 relations = true
  107.                 deprecated = false
  108.                 records = true
  109.                 immutablePojos = true
  110.                 fluentSetters = true
  111.             }
  112.             target {
  113.                 packageName = 'com.mycompany.jooq'
  114.                 directory = generatedDir
  115.             }
  116.         }
  117.     }
  118. }
  119.  
  120. // Task to create the jar containing all the libraries
  121. shadowJar {
  122.     mergeServiceFiles()
  123.     archiveName = "${project.ext.name}.jar"
  124. }
  125.  
  126. run.classpath += configurations.developmentOnly
  127. run.jvmArgs('-noverify', '-XX:TieredStopAtLevel=1', '-Dcom.sun.management.jmxremote')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement