title: Gradle, Kotlin, Multi Module Project: Getting build errors while compiling this project
body: <p>I am getting the following error on running gradle build command on root folder.</p>
  
  <pre><code>E:\Code\mdh&gt;gradle build
  
  &gt; Task :multidemo:compileKotlin FAILED
  e: E:\Code\mdh\multidemo\src\main\kotlin\com\simbalarry\multidemo\SampleController.kt: (3, 23): Unresolved reference: somelib
  e: E:\Code\mdh\multidemo\src\main\kotlin\com\simbalarry\multidemo\SampleController.kt: (18, 12): Unresolved reference: Tester
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':multidemo:compileKotlin'.
  &gt; Compilation error. See log for more details
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 5s
  4 actionable tasks: 1 executed, 3 up-to-date
  </code></pre>
  
  <p>Below is my project structure and multidemo project is using some functionalities of somelib. Also, I have deliberetly kept somelib as spring boot project as I will be adding more spring boot related functionalities later.</p>
  
  <pre><code>Root Project
    |
    |---settings.gradle
    |---somelib
    |       |
    |       |---build.gradle
    |       |---settings.gradle
    |       |---src/main/kotlin/somepackage/Tester.kt
    |       |---src/main/kotlin/somepackage/SomeLibApplication.kt
    |
    |---multidemo
    |       |---build.gradle
    |       |---settings.gradle
    |       |---src/main/kotlin/somepackage/SampleController.kt
    |       |---src/main/kotlin/somepackage/MultidemoApplication.kt
  </code></pre>
  
  <p>Below are the contents of every file</p>
  
  <p>Root/settings.gradle</p>
  
  <pre><code>include ':somelib', ':multidemo'
  </code></pre>
  
  <p>somelib/build.gradle</p>
  
  <pre><code>plugins {
      id 'org.springframework.boot' version '2.1.3.RELEASE'
      id 'org.jetbrains.kotlin.jvm' version '1.3.21'
      id 'org.jetbrains.kotlin.plugin.spring' version '1.3.21'
  }
  
  apply plugin: 'io.spring.dependency-management'
  
  group = 'com.simbalarry'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = '1.8'
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      implementation 'org.springframework.boot:spring-boot-starter-web'
      implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
      implementation 'org.jetbrains.kotlin:kotlin-reflect'
      implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
      testImplementation 'org.springframework.boot:spring-boot-starter-test'
  }
  
  compileKotlin {
      kotlinOptions {
          freeCompilerArgs = ['-Xjsr305=strict']
          jvmTarget = '1.8'
      }
  }
  
  compileTestKotlin {
      kotlinOptions {
          freeCompilerArgs = ['-Xjsr305=strict']
          jvmTarget = '1.8'
      }
  }
  </code></pre>
  
  <p>somelib/settings.gradle</p>
  
  <pre><code>pluginManagement {
      repositories {
          gradlePluginPortal()
      }
  }
  rootProject.name = 'somelib'
  </code></pre>
  
  <p>somelib/src/main/kotlin/somepackage/Tester.kt</p>
  
  <pre><code>package com.simbalarry.somelib
  
  
  /*
   * Created on : 17-03-2019
   * Author     : Nayan Kurude
   */
  
  object Tester {
    fun getOutputText(): String {
      return "Sample Text"
    }
  }
  </code></pre>
  
  <p>somelib/src/main/kotlin/somepackage/SomelibApplication.kt</p>
  
  <pre><code>package com.simbalarry.somelib
  
  import org.springframework.boot.autoconfigure.SpringBootApplication
  import org.springframework.boot.runApplication
  
  @SpringBootApplication
  class SomelibApplication
  
  fun main(args: Array&lt;String&gt;) {
      runApplication&lt;SomelibApplication&gt;(*args)
  }
  </code></pre>
  
  <p>multidemo/build.gradle</p>
  
  <pre><code>plugins {
      id 'org.springframework.boot' version '2.1.3.RELEASE'
      id 'org.jetbrains.kotlin.jvm' version '1.3.21'
      id 'org.jetbrains.kotlin.plugin.spring' version '1.3.21'
  }
  
  apply plugin: 'io.spring.dependency-management'
  
  group = 'com.simbalarry'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = '1.8'
  
  repositories {
      mavenCentral()
      mavenLocal()
  }
  
  dependencies {
      implementation 'org.springframework.boot:spring-boot-starter-web'
      implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
      implementation 'org.jetbrains.kotlin:kotlin-reflect'
      implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
      compile project(':somelib')
      testImplementation 'org.springframework.boot:spring-boot-starter-test'
  }
  
  compileKotlin {
      kotlinOptions {
          freeCompilerArgs = ['-Xjsr305=strict']
          jvmTarget = '1.8'
      }
  }
  
  compileTestKotlin {
      kotlinOptions {
          freeCompilerArgs = ['-Xjsr305=strict']
          jvmTarget = '1.8'
      }
  }
  </code></pre>
  
  <p>multidemo/settings.gradle</p>
  
  <pre><code>pluginManagement {
      repositories {
          gradlePluginPortal()
      }
  }
  rootProject.name = 'multidemo'
  </code></pre>
  
  <p>multidemo/src/main/kotlin/somepackage/MultiDemoApplication.kt</p>
  
  <pre><code>package com.simbalarry.multidemo
  
  import org.springframework.boot.autoconfigure.SpringBootApplication
  import org.springframework.boot.runApplication
  
  @SpringBootApplication
  class MultidemoApplication
  
  fun main(args: Array&lt;String&gt;) {
      runApplication&lt;MultidemoApplication&gt;(*args)
  }
  </code></pre>
  
  <p>multidemo/src/main/kotlin/somepackage/SampleController.kt</p>
  
  <pre><code>package com.simbalarry.multidemo
  
  import com.simbalarry.somelib.Tester
  import org.springframework.web.bind.annotation.RequestMapping
  import org.springframework.web.bind.annotation.RestController
  
  
  /*
   * Created on : 17-03-2019
   * Author     : Nayan Kurude
   */
  
  @RestController
  class SampleController {
  
    @RequestMapping("/hello")
    fun hello(): String {
      return Tester.getOutputText()
    }
  }
  </code></pre>
  
  <p>Could anyone please tell me where am i doing something wrong.</p>