Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Executing External Processes From Groovy
 Goal: execute a program via a command line from groovy code

Option 1: executing a string


Limits:
 If you wish to pass a quoted argument that contains white space it will be split into multiple arguments
"""executable "first with space" second"""
each is treated as a separate arg be the external executable:* arg1 = "first

  • arg2 = with
  • arg3 = space"
  • arg4 = second

Option 2: using ant builder's exec task


Ant has an exec task and it be accessed from the AntBuilder object


The good thing is that you now have all the ant features at your disposal and Ant will not break up quoted args  containing whitespace.

  • No labels