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

白昼怎懂夜的黑 提交于 2020-01-06 05:03:18

问题


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.

  • Q1. How should I pass the command line arguments to the method in groovy?
  • Q2. Any documentation on groovy which can get me started quickly?

回答1:


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



来源:https://stackoverflow.com/questions/10033853/how-to-pass-arguments-to-ant-java-method-in-groovy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!