com.github.psxpaul.task.JavaExecFork.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-execfork-plugin Show documentation
Show all versions of gradle-execfork-plugin Show documentation
A gradle plugin to execute applications in the background
package com.github.psxpaul.task
import org.gradle.api.file.FileCollection
import org.gradle.internal.jvm.Jvm
open class JavaExecFork : AbstractExecFork() {
var classpath: FileCollection? = null
var main:String? = null
var jvmArgs:List = listOf()
override fun getProcessArgs(): List? {
val processArgs:MutableList = mutableListOf()
processArgs.add(Jvm.current().javaExecutable.absoluteFile.absolutePath)
processArgs.add("-cp")
processArgs.add(classpath!!.asPath)
processArgs.addAll(jvmArgs.map { s -> if (s.startsWith("-D")) return@map s else "-D" + s })
processArgs.add(main!!)
processArgs.addAll(args)
return processArgs
}
}