pankajt
pankajt

Reputation: 7864

How to pass arguments to ant.java() method in Groovy

I am trying to convert an ant <java> task to groovy. I am using the following code:

def ant = new AntBuilder();
ant.java(classpath:'jar_file_path', classname:'Main', fork:'true')

I also have a list of command line arguments to be passed to the method.

Upvotes: 0

Views: 1128

Answers (1)

tim_yates
tim_yates

Reputation: 171114

You should be able to do:

def ant = new AntBuilder();
ant.java(classpath:'jar_file_path', classname:'Main', fork:'true') {
  arg( value: 'arg 1' )
}

As for learning Groovy, the second edition of groovy in action is available as a early access ebook

Upvotes: 4

Related Questions