【发布时间】:2016-09-19 14:53:26
【问题描述】:
我有简单的脚本
package com.lapots.game.journey.ims.example
fun main(args: Array<String>) {
println("Hello, world!")
}
这里是gradle 任务
task runExample(type: JavaExec) {
main ='com.lapots.game.journey.ims.example.Example'
classpath = sourceSets.main.runtimeClasspath
}
但是当我尝试运行任务 gradle runExample 时出现错误
Error: Could not find or load main class com.lapots.game.journey.ims.example.Example
运行应用程序的正确方法是什么?
【问题讨论】:
-
有一节关于使用 Gradle 应用程序插件运行 Kotlin 应用程序:stackoverflow.com/a/26402542/3679676 ... 或者您是否需要它以其他方式运行,就好像它是一个任务一样?但这个答案也可以为您提供所需的线索。