在kotlin中为gradle脚本配置IntelliJ自动完成

The*_*ect 20 intellij-idea gradle kotlin

我正在使用IntelliJ中的简单hello-world应用程序尝试gradle-script-kotlin.但是,build.gradle.kts文件中不会弹出IntelliJ自动完成功能.

https://github.com/gradle/gradle-script-kotlin/tree/master/samples/hello-world

build.gradle.kts:

apply<ApplicationPlugin>()

configure<ApplicationPluginConvention> {
    mainClassName = ".HelloWorld"
}

configure<JavaPluginConvention> {
    setSourceCompatibility(1.8)
    setTargetCompatibility(1.8)
}

repositories {
    jcenter()
}

dependencies {
    testCompile("junit:junit:4.12")
}
Run Code Online (Sandbox Code Playgroud)

settings.gradle:

rootProject.buildFileName = 'build.gradle.kts'
Run Code Online (Sandbox Code Playgroud)

我安装了IntelliJ kotlin插件和gradle插件并使用gradle 3.0.示例应用程序使用gradle命令.

如何配置IntelliJ以在build.gradle.kts文件上启用自动完成?

我正在使用IntelliJ 2016.2.2和kotlin插件版本:1.0.3-release-IJ2016.1-120

Lau*_*auw 8

有同样的问题.Gradle脚本Kotlin需要1.1x版本的IntelliJ Kotlin插件.

请按照以下步骤进行安装:https:
//github.com/gradle/gradle-script-kotlin/tree/master/samples#install-idea-kotlin-plugin

常规更新通道现在只更新到1.0.3x版.

更新18/06:
github自述文件已更新,包括:
(Note: this version will not work with the official Gradle 3.0 release, stick to the official EAP 1.1 from JetBrains if you intend to use Gradle 3.0)

如果您之前手动安装了版本1.1.0-dev-2222,请将其卸载并重新启动IntelliJ.

从EAP Channel安装1.1.x版

此版本适用于Gradle 3.0中的Kotlin-Script.

在IntelliJ中,按:
Tools => Kotlin => Configure Kotlin Updates.
选择
Early Access Preview 1.1
并按
Check for updates now.

下载最新的插件.
如果它出错,只需重新启动IntelliJ,它就会安装插件.


mem*_*izr -2

尝试通过选择重新导入项目settings.gradle