开发者

How do you launch a shell script from ant on a Mac?

开发者 https://www.devze.com 2022-12-19 06:45 出处:网络
On linux something like: <target name=\"r开发者_如何学JAVAunDo\"> <exec executable=\"gnome-terminal\" spawn=\"true\">

On linux something like:

  <target name="r开发者_如何学JAVAunDo">
     <exec executable="gnome-terminal" spawn="true">
      <arg line="-t 'Title' --geometry=120x80 -e '/script/path/bin/do.sh'"/>
    </exec>
  </target>

Works fine.

I've tried installing xterm, gnome-terminal and rxvt via macports and running them similarly with no results as well as /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal -e, but none seem to work. I've also tried running the script as the attribute value of executable, hoping the OS would pick an appropriate applications to launch, but no joy.

I can get it to run without spawning a new terminal, but I'm running the ant task from an IDE and would like to be able to keep it alive if I quit the IDE, or close the project to open another. Help?


Just went with xterm...

<target name="startTomcat_DebugLinux" if="isLinux">
  <exec executable="gnome-terminal" spawn="true">
    <arg line="--window-with-profile=Tomcat --geometry=120x60 -e '${env.CATALINA_HOME}/bin/catalina.sh jpda run'" />
  </exec>
</target>

<target name="startTomcat_DebugMac" if="isMac">
  <exec executable="/usr/X11R6/bin/xterm" spawn="true">
    <arg  line="-geometry 180x65 -e ${env.CATALINA_HOME}/bin/catalina.sh jpda run" />
  </exec>
</target>

The problem before, that open -a couldn't help with was that I couldn't get the arguments jpda and run passed to the script. open takes a --args, but the args seem to be passed to terminal rather than the script. Other solutions are welcome, but this is working for me now.


Try open -a Terminal /script/path/bin/do.sh.


You should just be able to run it against /bin/sh and have it appear inline with the ant output.

0

精彩评论

暂无评论...
验证码 换一张
取 消