1

I'm trying to setup the gradle-kotlin-plugin locally, but it doesnt work at all. Im using Gradle 4.9 and Kotlin version 1.2.71. The Gradle sync fails and this exceptions is thrown:

org/jetbrains/kotlin/cli/common/PropertiesKt

NoClassDefFoundError: org/jetbrains/kotlin/cli/common/PropertiesKt

Im put all needed resources into the directory /lib/kotlin, meaning kotlin-gradle-plugin-1.2.71.jar, kotlin-stdlib-1.2.70.jar,kotlin-stdlib-1.2.70.pom,kotlin-stdlib-common-1.2.70.jar,kotlin-stdlib-common-1.2.70.pom. If i set the repo to url "https://plugins.gradle.org/m2/" everything is working fine(i always want to load the plugin from the local file and NOT from the online repo). The other kotlin dependencies are also included.

build.gradle

 buildscript {
        ext.kotlin_version = '1.2.71'
        repositories {
        flatDir dirs: '/lib/kotlin'
        mavenLocal()
        maven{
            url uri('lib/kotlin')
        }
 dependencies {

        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"


    }
    ...
    allprojects {
    apply plugin: 'java'
    apply plugin: 'application'
    apply plugin: "kotlin"
    ..
    dependencies {
        compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

Edit: Now the plugin is working but Kotlin is not compiling and is telling me:

  Could not perform incremental compilation: Could not connect to Kotlin compile daemon
Could not connect to kotlin daemon. Using fallback strategy.
Exception in thread "main" java.lang.NoClassDefFoundError: kotlin/jvm/internal/Intrinsics
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler$Companion.main(K2JVMCompiler.kt)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.main(K2JVMCompiler.kt)
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.Intrinsics
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 2 more

1 Answer 1

1

Try adding below dependency also

compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

Do clean your ~/.gradle directory

Sign up to request clarification or add additional context in comments.

1 Comment

i followed stackoverflow.com/questions/34181002/… approach und got a NoClassDefFoundError: kotlin/jvm/internal/Intrinsics Exception

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.