无法在Kotlin上导入gradle依赖项的类

时间:2018-06-22 03:20:36

标签: gradle intellij-idea import kotlin dependencies

我在使用Gradle时遇到问题,我的依赖项已下载,并且很好地包含在“外部库”中,但是我无法在IntelliJ IDEA中导入其类。

请参见以下图片:

External Libraries

Importing Error

这是我的build.gradle:

buildscript {
ext.kotlin_version = '1.2.50'

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

group 'cf.dogo'
version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: 'maven'

mainClassName = "cf.dogo.core.boot.BootKt"

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
    maven {url 'https://jitpack.io'}
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-reflect"
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    compile 'net.dv8tion:JDA:3.6.0_376'
    compile 'org.mongodb:mongodb-driver:3.6.3'
    compile 'com.github.NathanPB:DogoAPI:master-SNAPSHOT' //That one is the problematic dependency
}

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

jar {
    manifest {
        attributes 'Main-Class': 'cf.dogo.core.boot.BootKt'
    }
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}

请注意,它来自JitPack

谢谢。

0 个答案:

没有答案