2
目前,我在gradle这个是这样的创建可执行任务的gradle
class MyTask extends DefaultTask {
@TaskAction
public void run() {
}
}
像这样的事情,我可以做的build.gradle
task stopTomcat(type:Exec) {
workingDir '../tomcat/bin'
//on windows:
commandLine 'cmd', '/c', 'stop.bat'
//on linux
commandLine './stop.sh'
//store the output instead of printing to the console:
standardOutput = new ByteArrayOutputStream()
//extension method stopTomcat.output() can be used to obtain the output:
ext.output = {
return standardOutput.toString()
}
}
一个任务,我想使这个任务执行访问commandLine,workingDir等。我该如何做到这一点?
你是什么意思的可执行做?你是什么意思_“访问commandLine,workingDir等”_ –
@tim_yates。在问题的主体中增加了更多信息 – user12331