apply plugin: 'application'
def createScript(project, mainClass, name) {
project.tasks.create(name: name, type: CreateStartScripts) {
outputDir = new File(project.buildDir, 'scripts')
mainClassName = mainClass
applicationName = name
classpath = project.tasks[JavaPlugin.JAR_TASK_NAME].outputs.files + project.configurations.runtime
}
project.tasks[name].dependsOn(project.jar)
project.applicationDistribution.with {
into("bin") {
from(project.tasks[name])
fileMode = 0755
}
}
project.tasks[name].doLast {
unixScript.text = unixScript.text.replace("\$CLASSPATH", ".:\$APP_HOME/lib/*")
//windowsScript.text = windowsScript.text.replace("%CLASSPATH%", ".;%APP_HOME%\\lib\\*")
}
}
startScripts.enabled = false
run.enabled = false
createScript(project, 'com.gigabyte.HelloWorld ', 'helloworld')
沒有留言:
張貼留言