Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/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
Ant运行bat文件并继续_Ant_Asynchronous_Batch File_Exec - Fatal编程技术网

Ant运行bat文件并继续

Ant运行bat文件并继续,ant,asynchronous,batch-file,exec,Ant,Asynchronous,Batch File,Exec,我被一个愚蠢的问题缠住了。问题是: 我需要启动一个专有的自制服务器。此服务器是使用.bat文件启动的(我在Windows操作系统上) 我写了一个目标: 启动愚蠢的服务器.bat 服务器端口 因此,执行bat文件时,服务器侦听端口。Ant编写构建成功,并且没有退出。 Ant等待服务器窗口关闭。 我尝试了100500种方法来克服它,但没有成功。 在Ant中有没有一种方法可以创建一个bat文件并将其忘掉 没有帮助,因为Ant关闭服务器窗口,服务器关闭 我尝试了: start start-stupid-

我被一个愚蠢的问题缠住了。问题是:

我需要启动一个专有的自制服务器。此服务器是使用.bat文件启动的(我在Windows操作系统上)

我写了一个目标:

  • 启动愚蠢的服务器.bat
  • 服务器端口
  • 因此,执行bat文件时,服务器侦听端口。Ant编写构建成功,并且没有退出。 Ant等待服务器窗口关闭。 我尝试了100500种方法来克服它,但没有成功。 在Ant中有没有一种方法可以创建一个
    bat文件并将其忘掉

    没有帮助,因为Ant关闭服务器窗口,服务器关闭

    我尝试了

    start start-stupid-server.bat,
    start /b start-stupid-server.bat
    
    没有任何帮助:(Ant仍在等待服务器窗口关闭

    我的目标是:

    <target name="start_proprietary_server" depends="bootstrap">
        <echo message="going to stop MDM server instance... "/>
        <forget daemon="true">
            <exec executable="${app.custom.root}/bin/stopAll.bat" dir="${app.custom.root}/bin"  />
        </forget>
        <waitfor
                maxwait="20" maxwaitunit="second"
                checkevery="1" checkeveryunit="second" timeoutproperty="mdm.stop.error">
            <and>
                <not> <socket server="localhost" port="12000" /> </not>
                <not> <socket server="localhost" port="14444" /> </not>
            </and>
        </waitfor>
    
        <if>
            <isset property="mdm.stop.error" />
            <then>
                <echo message="There are some problems while stopping MDM server. See what's went wrong" />
            </then>
            <else>
                <echo message="MDM server successfully stoped." />
            </else>
        </if>
    
        <echo message="going to start MDM server instance... "/>
    
        <!--
            Starts but doesn't exit target
            <exec executable="cmd" dir="${app.custom.root}/bin" >
                <arg value="/c start startAll.bat" />
            </exec>
        -->
    
        <!--
            <forget daemon="true">
                <exec executable="cmd" dir="" >
                    <arg value="/c startAll.bat" />
                </exec>
            </forget>
        -->
    
        <forget daemon="true">
            <exec executable="${app.custom.root}/bin/startAll.bat" dir="${app.custom.root}/bin"  />
        </forget>
    
    
        <echo message="Wating for localhost ports #12000 and #14444"/>
        <waitfor
                maxwait="40" maxwaitunit="second"
                checkevery="3" checkeveryunit="second" timeoutproperty="mdm.start.error">
            <and>
                <socket server="localhost" port="12000" />
                <socket server="localhost" port="14444" />
            </and>
        </waitfor>
    
        <if>
            <isset property="mdm.start.error" />
            <then>
                <echo message="There are some problems while starting MDM server. See what's went wrong" />
            </then>
            <else>
                <echo message="MDM server has been started." />
            </else>
        </if>
    </target>
    
    我尝试使用
    forget
    标记执行它,使用
    start
    start/b
    call
    ,但没有任何帮助。Ant在服务器窗口关闭之前不会完成任务

    如果我在没有忘记的情况下使用spawn,Ant将在退出目标时关闭服务器窗口。它将spawn与忘记一起使用,直到服务器窗口关闭,Ant目标才会完成


    下一步可以尝试什么?

    您可以创建另一个批处理文件,使用
    start
    命令启动服务器并立即返回:

    start <path_to_server_bat> <args>
    
    开始
    

    您是否尝试过
    spawn=true

    您可以创建另一个批处理文件,使用
    start
    命令启动服务器并立即返回:

    start <path_to_server_bat> <args>
    
    开始
    

    你试过
    spawn=true

    你能提供更多信息吗?也许看看你的批处理文件会有帮助。嗨,Brad。我已经添加了关于这个问题的更多信息。我累了:忘记,shellscript,exec,call,start…没有任何帮助。Ant在专有的start\u server.bat关闭之前不会完成目标。你能提供更多信息吗?也许吧ps查看您的批处理文件会有所帮助。嗨,Brad。我已经添加了有关该问题的更多信息。我累了:忘记,shellscript,exec,call,start…没有任何帮助。Ant在专有的start\u server.bat关闭之前不会完成目标。