• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Trouble launching ant exec task

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using Ant 1.7 on Mac 10.6.3. In my .bash_profile, I have defined an alias called "restart", that runs some commands. I would like to execute this same alias in my ant task, but '<exec executable="restart" />' isn't working. Here is my larger target ...



Instead I get the error ...

/Users/davea/projects/LVCVA/LVCVA/ant/build.xml:293: Execute failed: java.io.IOException: Cannot run program "restart" (in directory "/Users/davea/projects/LVCVA/LVCVA/ant"): error=2, No such file or directory

Any ideas what I can do to address the problem? Thanks, - Dave
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you can <exec> an alias. An alias is something defined to bash and is specific to bash, whereas <exec> communicates to the OS (not to bash). So try <exec>ing bash, passing the alias to bash.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You mean pass in "bash" as the executable and have my aliased command as my argument? - Dave
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Or define it as a shell script as opposed to an alias--arguably cleaner.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So when I do this



is the second exec waiting for the first to complete? If not, how can I force that? Also, normally I see output from these commands but I don't when I run the ant task. Anyway to get it pipe the output to the terminal?

Thanks, - Dave
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not use the Tomcat Ant tasks?
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dave Alvarado wrote:You mean pass in "bash" as the executable and have my aliased command as my argument? - Dave


Yes. Check out the -c option in the bash man pages.

Also, you can run a script directly via <exec>, you do not have to do it via bash.
 
Your mother is a hamster and your father smells of tiny ads!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic