我正在尝试使用Gradle,但是Idea看不到依赖项。这是我的build.gradle
group 'me.ozka'
version '1.0.1'
buildscript {
ext.kotlin_version = '1.0.3'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = 1.5
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile group: 'junit', name: 'junit', version: '4.11'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.20'
compile 'org.eclipse.jetty:jetty-server:9.0.0.RC2'
compile 'org.eclipse.jetty:jetty-servlet:9.0.0.RC2'
}
当我尝试导入import org.eclipse.jetty.server.Server;想法告诉我一个错误。我做错了什么?
upd:我也没有在Idea External库文件夹中看到jar文件。
upd2:我要添加到生成文件中,应用插件:“jetty”,它可以解决我的问题!
最佳答案
您需要刷新gradle依赖项。
这是一些方法。
方法1(GUI):
View -> Tool Windows -> Gradle
方法2(命令):
gradle build --refresh-dependencies
关于intellij-idea - Idea项目中的Gradle依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38954720/