Kotlin Require Library with Gradle Build

1.6k views Asked by At

I'm trying to add the library Exposed to my project. So, it leads me to the bintray page where it says to use compile 'org.jetbrains.exposed:exposed:0.8.5'. I open my file build.gradle and place that file into the dependencies segment:

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
    compile 'org.jetbrains.exposed:exposed:0.8.5'
}

IntelliJ auto builds it and I get the following error

Warning:root project 'DB-Table-To-Orm': Unable to build Kotlin project configuration Details: java.lang.reflect.InvocationTargetException: null Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compileClasspath'. Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find org.jetbrains.exposed:exposed:0.8.5. Searched in the following locations: https://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.pom https://repo1.maven.org/maven2/org/jetbrains/exposed/exposed/0.8.5/exposed-0.8.5.jar Required by: project :

So, I look in the repo and there is no path beyond jetbrains with the exposed directory.

How do I install the Exposed library with Gradle? Do they have the path written down incorrectly? Should I put in a bug report with the project? Or am I just putting the compile statement in the wrong location?

Sorry, if this seems like a silly request, I'm new to Javaland and Kotlin and IntelliJ. Coming for the .NET world.

Update

Here's the build.gradle in its entirety:

group 'com.awebsite.db-table-to-orm'
version '1.0-SNAPSHOT'

buildscript {
    ext.kotlin_version = '1.1.4-2'

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

apply plugin: 'kotlin'

repositories {
    mavenCentral()
    jcenter()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
    compile 'org.jetbrains.exposed:exposed:0.8.5'
}

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

There are 1 answers

3
Mibac On BEST ANSWER

As far as I know Exposed isn't in the main bintray repo (aka jcenter). To make gradle search in Exposed's repo you need to add this:

maven {
    url  "https://dl.bintray.com/kotlin/exposed" 
}

to your repositories section.

Example:

repositories {
    mavenCentral()
    maven {
        url  "https://dl.bintray.com/kotlin/exposed" 
    }
}

Then just rebuild and it should work just fine