我在使用Gradle时遇到问题,我的依赖项已下载,并且很好地包含在“外部库”中,但是我无法在IntelliJ IDEA中导入其类。
请参见以下图片:
这是我的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。
谢谢。