This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble launching ant exec task

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • 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
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
You mean pass in "bash" as the executable and have my aliased command as my argument? - Dave
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use the Tomcat Ant tasks?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic