如何在gradle中插入想法插件为Kotlin生成适当的项目配置?

我已经配置我的build.gradle运行gradle testgradle run正常gradle run 。 但是,在导入由gradle idea生成的配置后,IDEA不显示任何run/test任务。 看来这些任务根本不包括在ipr / iws中。

这是我的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" } 

我想知道有什么办法使生成的项目配置包括这些任务( run / test )? 我也听到有人说不要使用gradle的想法 ,所以用gradle idea来实现这个是不可能的?

你的情况根本没有必要。 只需打开IDEA的build.gradle文件,一切都应该是平滑的。 Gradle插件的idea有点不赞成。 不是正式的,但它是由Gradle团队创建的,并没有积极地开发来适应新的IDEA版本和function等等。 所以,如果你不需要特别的定制,只需打开IDEA的build.gradle ,你应该很好去。