Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Groovy AntBuilder在后台执行任务_Groovy_Antbuilder - Fatal编程技术网

Groovy AntBuilder在后台执行任务

Groovy AntBuilder在后台执行任务,groovy,antbuilder,Groovy,Antbuilder,我需要你的帮助: 尝试在Groovy中执行ant任务,以便它不会等待来自脚本的响应(即在后台运行) 我试过以下两种方法,但都没有成功 //Cannot find script ant.exec(failonerror: "true", executable: "scriptname.sh &") // Says: You have used an attribute or nested element which is not compatible with spawn ant.e

我需要你的帮助:

尝试在Groovy中执行ant任务,以便它不会等待来自脚本的响应(即在后台运行)

我试过以下两种方法,但都没有成功

//Cannot find script
ant.exec(failonerror: "true", executable: "scriptname.sh &") 

// Says: You have used an attribute or nested element which is not compatible with spawn 
ant.exec(failonerror: "true", spawn:"true", executable: "scriptname.sh") 
关于如何做到这一点有什么建议吗?我搜索过谷歌,但找不到Groovy的好例子


谢谢大家,我感谢你们的帮助。

script.sh

#!/bin/bash

cat > foo.conf << EOF
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
    ServerName localhost
</VirtualHost>
EOF
#/bin/bash

cat>foo.conf在文档有限的AntBuilder中,我没有尝试找出如何执行此操作,而是创建了第二个shell脚本,在后台执行所需的shell脚本

#!/bin/bash

command="./scriptname.sh  $1 $2 $3 $4"

nohup $command > /dev/null 2>&1 &

不幸的是,我对gradle不是特别熟悉,我的系统架构相当先进,安装了包含shell脚本的驱动器。我试图通过编写第二个shell脚本来简化我的解决方案,并成功了。我感谢你抽出时间回答。
#!/bin/bash

command="./scriptname.sh  $1 $2 $3 $4"

nohup $command > /dev/null 2>&1 &