mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Don't run projects that don't have an application{} config.
This commit is contained in:
parent
6dac9a92c1
commit
bf26f6a65b
1 changed files with 5 additions and 3 deletions
|
@ -49,12 +49,14 @@ class ApplicationPlugin @Inject constructor(val executors: KobaltExecutors) : Ba
|
||||||
|
|
||||||
@Task(name = "run", description = "Run the main class", runAfter = arrayOf("assemble"))
|
@Task(name = "run", description = "Run the main class", runAfter = arrayOf("assemble"))
|
||||||
fun taskRun(project: Project): TaskResult {
|
fun taskRun(project: Project): TaskResult {
|
||||||
configs[project.name].let { config ->
|
configs[project.name]?.let { config ->
|
||||||
val java = JavaInfo.create(File(SystemProperties.javaBase)).javaExecutable!!
|
val java = JavaInfo.create(File(SystemProperties.javaBase)).javaExecutable!!
|
||||||
if (config != null && config.mainClass != null) {
|
if (config.mainClass != null) {
|
||||||
val jarName = context.pluginProperties.get("packaging", PackagingPlugin.JAR_NAME) as String
|
val jarName = context.pluginProperties.get("packaging", PackagingPlugin.JAR_NAME) as String
|
||||||
val args = listOf("-classpath", jarName) + config.jvmArgs + config.mainClass!!
|
val args = listOf("-classpath", jarName) + config.jvmArgs + config.mainClass!!
|
||||||
RunCommand(java.absolutePath).run(args)
|
RunCommand(java.absolutePath).run(args, successCallback = { output: List<String> ->
|
||||||
|
println(output.joinToString("\n"))
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
throw KobaltException("No \"mainClass\" specified in the application{} part of project ${project.name}")
|
throw KobaltException("No \"mainClass\" specified in the application{} part of project ${project.name}")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue