[英]How to make idea plugin in gradle generate proper project configuration for Kotlin?
I have configured my build.gradle
to run gradle test
and gradle run
properly. 我已经将
build.gradle
配置为运行gradle test
并且gradle run
正常。 However, IDEA does not show any run/test
tasks after importing the configuration generated by gradle idea
. 但是,在导入
gradle idea
生成的配置之后,IDEA不会显示任何run/test
任务。 It seems that these tasks are not included at ipr
/ iws
at all. 看来,
ipr
/ iws
根本不包含这些任务。
Here is my build.gradle
: 这是我的
build.gradle
:
buildscript {
ext.kotlin_version = '1.2.0'
repositories {
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.2'
}
}
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'application'
apply plugin: 'org.junit.platform.gradle.plugin'
apply plugin: 'idea'
dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/javadoc"
}
sourceSets {
test.kotlin.srcDirs += 'src/test/kotlin'
}
junitPlatform {
enableStandardTestTask true
}
defaultTasks 'run'
mainClassName = 'simpledb.server.Startup'
repositories {
maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.2'
testRuntime (
'org.junit.jupiter:junit-jupiter-engine:5.0.2',
'org.junit.platform:junit-platform-launcher:1.0.2'
)
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}
I was wondering is there any way to make generated project configurations include these tasks( run
/ test
)? 我想知道有什么方法可以使生成的项目配置包括这些任务(
run
/ test
)吗? I have also heard people saying Don't use gradle idea , so is it impossible to use gradle idea
to implement this? 我也听到人们说不要使用gradle想法 ,所以不可能使用
gradle idea
来实现这一点吗?
It is simply not necessary in your case. 在您的情况下,根本没有必要。 Just open the build.gradle file with IDEA and everything should be smooth.
只需使用IDEA打开build.gradle文件,一切就应该顺利了。 The
idea
Gradle plugin is somewhat deprecated. Gradle插件的
idea
有些过时了。 Not officially, but it was created by Gradle team and is not actively developed to adapt to new IDEA versions and features and so on. 它不是正式的,而是由Gradle团队创建的,并未积极开发以适应新的IDEA版本和功能等。 So if you don't need special customizations, just open the
build.gradle
with IDEA and you should be good to go. 因此,如果您不需要特殊的自定义设置,只需使用IDEA打开
build.gradle
,就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.