在kotlin中为Gradle脚本配置IntelliJ自动完成 [英] Configure IntelliJ auto-completion for gradle script in kotlin

查看:608
本文介绍了在kotlin中为Gradle脚本配置IntelliJ自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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)
}

存储库{
jcenter()
}

dependencies {
testCompile(junit:junit:4.12)
}

settings.gradle:

  rootProject.buildFileName ='build.gradle.kts'

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



如何配置IntelliJ以启用build.gradle.kts文件的自动完成功能?



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

解决方案

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



按照以下步骤安装它:

https://github.com/gradle/gradle-script-kotlin/tree/master/samples# install-idea-kotlin-plugin



常规更新频道现在只更新至1.0.3x版本。



Update 18/06:

github自述文件已更新为包含:

(注意:版本将无法与官方的Gradle 3.0版本一起使用,如果您打算使用Gradle 3.0,请使用JetBrains的官方EAP 1.1)



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

从EAP频道安装版本1.1.x



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



在IntelliJ中,按:

太ls => Kotlin =>配置Kotlin更新

选择

Early Access Preview 1.1

然后按

现在检查更新



下载最新的插件。

如果出现错误,只需重新启动IntelliJ,它将安装插件。


I am trying out gradle-script-kotlin with simple hello-world application in IntelliJ. But IntelliJ auto-completion doesn't popup in build.gradle.kts file.

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")
}

settings.gradle:

rootProject.buildFileName = 'build.gradle.kts'

I have IntelliJ kotlin plugin and gradle plugin installed and using gradle 3.0. The sample application works with gradle commands.

How to configure IntelliJ to enable auto-completion on build.gradle.kts file?

I'm using IntelliJ 2016.2.2 with kotlin plugin version: 1.0.3-release-IJ2016.1-120

解决方案

Had the same problem. Gradle script Kotlin requires version 1.1x of the IntelliJ Kotlin plugin.

Follow these steps to install it:
https://github.com/gradle/gradle-script-kotlin/tree/master/samples#install-idea-kotlin-plugin

The regular update channel only updates to version 1.0.3x right now.

Update 18/06:
The github readme has been updated to include:
(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)

If you manually installed version 1.1.0-dev-2222 earlier, uninstall it and restart IntelliJ.

Install version 1.1.x from the EAP Channel

This version works with Kotlin-Script in Gradle 3.0.

In IntelliJ, press:
Tools => Kotlin => Configure Kotlin Updates.
Select
Early Access Preview 1.1
and press
Check for updates now.

Download the latest plugin.
If it gives an error, just restart IntelliJ, it will have installed the plugin.

这篇关于在kotlin中为Gradle脚本配置IntelliJ自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆