gradlekotlinklaxon

I cannot get the Klaxon dependency in Intellij to register


I for the life of me cannot seem to get the Klaxon dependency to work in Intellij. Other dependencies I have added (like gson) have worked fine. I have tried refreshing Gradle, tried a different version, etc. Nothing seems to be working so I can use the library. I could be missing something obvious (new to Gradle and Kotlin). Any help or suggestions would be greatly appreciated.

Gradle Script:

plugins {
    id 'org.jetbrains.kotlin.jvm' version '1.3.11'
}

version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8",
            "com.beust:klaxon:5.0.5"
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

Import Won't Register

https://github.com/cbeust/klaxon

enter image description here


Solution

  • So where are you getting this download from? Is it from below?

    https://mvnrepository.com/artifact/com.beust/klaxon/5.0.5

    If so, you need to add the jcenter() repo, like so:

    repositories {
        mavenCentral()
        jcenter()
    } 
    

    I saw it because in the above link, it says that the repo is from Jcenter. I also tried searching the mavenCentral repo and couldn't find the klaxon directory.

    http://central.maven.org/maven2/com/beust/

    If this isn't an issue, try refreshing your dependencies through Gradle like so:

    (from proj dir) $ gradle clean
    (from proj dir) $ gradle --refresh-dependencies