0

I have a build.xml file with the following line at the end:

<ant dir="${basedir}/subfolder" target="mytarget" />

Then in the subfolder, I have another build.xml file with the following:

<target name="mytarget">
    <exec executable="open">
        <arg value="${basedir}/myApp.app" />
    </exec>
</target>

The myApp.app application is designed to be executed visibly on the screen, and not in the background. It is an app designed in Automator and it has mouse movement and clicking incorporated. I set up Jenkins to build this task on a slave, and when the task is built I want Jenkins to call the ant script which will launch this application, and then I want the application to actually cause the mouse to move around on the Jenkins slave. Right now Jenkins reports a successful build, but nothing seems to be happening.

UPDATE

When I run the exec with failonerror="true", no error prints to the Jenkins log. Jenkins just says mytarget: as though it is about to start printing the log info for that target, and then nothing happens and the build completes successfully, with nothing happening on the slave (the app is not launched).

UPDATE 2

I just had an interesting find. I replaced the line ${basedir}/myApp.app with /Applications/Dictionary.app, and when I ran that with Jenkins it opened up the dictionary for a tiny second and then closed it immediately. Could that be happening with my application too without anything showing up? My script has a delay in the beginning, so could it be closing during that period?

4

1 回答 1

0

open命令只是启动应用程序,但并不关心它的生命周期。它正在启动应用程序并将正在运行的线程返回给 Ant。然后 Ant 将终止exec任务、目标、构建和 Ant 本身。

我认为解决方案是添加-W选项,open以便它“等到它打开(或已经打开)的应用程序退出”。

<exec executable="open">
    <arg value="-W" />
    <arg value="${basedir}/myApp.app" />
</exec>
于 2013-06-26T20:51:33.837 回答