Ives
Ives

Reputation: 555

kotlin project can't be build in gradle

I have a java project that write in kotlin ,i use intelliJ IDEA to develop this project. I have trouble on the dependencies setting (multiple project). I already read lot of examples , but I can't find the workaround , here is my dependencies setting code, it can be build in java class correctly , but the kotlin class will get lot of error 'Unresolved reference' . Is that any wrong about my setting or gradle is not suitable with kotlin .

PS : when i only build core project , build process will successful , but build at test project will get the reference unresolved error

allprojects {
apply plugin: 'java'
apply plugin: 'kotlin'
group 'testProject'
version '1.0'
}



subprojects{
apply plugin:  'java'
apply plugin: 'kotlin'
def defaultEncoding = 'UTF-8'
compileJava.options.encoding = defaultEncoding
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {

    // Kotlin
    compile "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
}
project(':test') {
dependencies {
    compile project(':core')
    compile project(':testTwo')
}

project(':testTwo'){
dependencies{
    compile project(':core')
}

setting.gradle

include 'test','testTwo','core'

Upvotes: 1

Views: 2426

Answers (1)

D3xter
D3xter

Reputation: 6465

The kotlin-gradle-plugin is not a dependency of your subprojects, it is a dependency of the buildscript itself.

Follow the instructions on Plugin and Versions

Upvotes: 0

Related Questions