daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest May 16th, 2018 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. object Configuration {
  2.     val content = javaClass.classLoader.getResource("app.properties").readText()
  3. }
  4.    
  5. Exception in thread "main" java.lang.ExceptionInInitializerError
  6.     at com.example.AppKt.main(App.kt:8)
  7. Caused by: java.lang.IllegalStateException: javaClass.classLoader.ge…esource("app.properties") must not be null
  8.     at com.example.Configuration.<clinit>(Configuration.kt:4)
  9.     ... 1 more
  10.    
  11. my-app
  12. ├── backend
  13. |  ├── build.gradle
  14. |  └── src
  15. |     └── main
  16. |        ├── kotlin
  17. |        └── resources <-- app.properties here
  18. ├── common
  19. |  ├── build.gradle
  20. |  └── src
  21. |     └── main
  22. |        ├── kotlin
  23. |        └── resources
  24. ├── frontend
  25. |  ├── build.gradle
  26. |  └── src
  27. |     └── main
  28. |        ├── kotlin
  29. |        └── resources
  30. └── build.gradle
  31.    
  32. apply plugin: 'kotlin'
  33. apply plugin: 'kotlin-platform-jvm'
  34. apply plugin: 'com.github.johnrengelman.shadow'
  35.  
  36. buildscript {
  37.     ext {
  38.         exposed_version = '0.10.2'
  39.         h2_version = '1.4.197'
  40.         hikari_version = '3.1.0'
  41.         konfig_version = '1.6.7.0'
  42.         ktor_version = '0.9.2'
  43.         logback_version = '1.2.3'
  44.         shadow_version = '2.0.4'
  45.     }
  46.     dependencies {
  47.         classpath "com.github.jengelman.gradle.plugins:shadow:$shadow_version"
  48.     }
  49. }
  50.  
  51. repositories {
  52.     maven { url 'https://dl.bintray.com/kotlin/ktor' }
  53.     maven { url 'https://dl.bintray.com/kotlin/exposed' }
  54. }
  55.  
  56. dependencies {
  57.     implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  58.  
  59.     implementation "io.ktor:ktor-auth:$ktor_version"
  60.     implementation "io.ktor:ktor-gson:$ktor_version"
  61.     implementation "io.ktor:ktor-html-builder:$ktor_version"
  62.     implementation "io.ktor:ktor-server-netty:$ktor_version"
  63.  
  64.     implementation "com.h2database:h2:$h2_version"
  65.     implementation "com.zaxxer:HikariCP:$hikari_version"
  66.     implementation "org.jetbrains.exposed:exposed:$exposed_version"
  67.  
  68.     implementation "ch.qos.logback:logback-classic:$logback_version"
  69.     implementation "com.natpryce:konfig:$konfig_version"
  70.  
  71.     expectedBy project(':common')
  72. }
  73.  
  74. configurations {
  75.     implementation {
  76.         exclude group: 'org.jetbrains.kotlin', module: 'kotlin-runtime'
  77.     }
  78. }
  79.  
  80. sourceCompatibility = JavaVersion.VERSION_1_8
  81. targetCompatibility = JavaVersion.VERSION_1_8
  82. compileKotlin {
  83.     kotlinOptions.jvmTarget = '1.8'
  84. }
  85.  
  86. compileTestKotlin {
  87.     kotlinOptions.jvmTarget = '1.8'
  88. }
  89.  
  90. kotlin {
  91.     experimental {
  92.         coroutines 'enable'
  93.     }
  94. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top