• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Trouble launching ant exec task

 
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
 
author
Posts: 5856
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
 
Author
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
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
Posts: 5856
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.
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!