aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Trouble launching ant exec task Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Trouble launching ant exec task" Watch "Trouble launching ant exec task" New topic
Author

Trouble launching ant exec task

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
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

Joined: May 14, 2008
Posts: 5842
    
    7

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.


JBoss In Action
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
You mean pass in "bash" as the executable and have my aliased command as my argument? - Dave
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Or define it as a shell script as opposed to an alias--arguably cleaner.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
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

Joined: Sep 29, 2008
Posts: 12617

Why not use the Tomcat Ant tasks?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5842
    
    7

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Trouble launching ant exec task