如何在gradle中插入想法插件为Kotlin生成适当的项目配置?
我已经配置我的build.gradle
运行gradle test
和gradle 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
,你应该很好去。
- 在Android Studio 3.0 Canary中,Gradle Sync失败
- 如何正确配置Gradle的Kotlin插件?
- jvmArgs设置的魅力报告
- 执行失败的任务'应用程序:copyDebugAndroidTestKotlinClasses' – Android的Kotlin生成错误
- Kotlin脚本为Gradle配置 – 传递参数不使用扩展名
- 在MANIFEST.MF中将Kotlin类指定为Main-Class入口点?
- 具有不同源代码集的Gradle任务
- ResourceNotFoundException在升级到Canary 6后,在API 16 AVD上运行Kotlin项目
- 有没有办法使用Gradle将Kotlin类编译为JavaScript?