开发者

Alternative to ANT as task execution engine?

I have to automate quite a lot in my current project. For this, I use ANT as it provides quite some commands. However, I have to use ant-contrib as I need for loops and other additional parts.

I use a model driven approach and have to automate the whole chain containing several models until the final model is created.

开发者_如何学JAVA

Is there an alternative to ANT that also provides an easy way to specify task execution? Maybe a DSL for this purpose? Is there anything like this out there?


If you have a modern version of Ant (e.g. 1.8.1) you can use the scriptcondition task/element to run arbitrary scripts with all the control flow of a proper programming language in it.

Something like this:

<condition>
  <scriptcondition language="javascript" value="true">
    for(var i in self) { println(i); }
    self.setValue('true');
  </scriptcondition>
</condition>

See also: http://ant.apache.org/manual/index.html


You could use any scripting language that suits your requirements:

e.g.

  • Bash/Shell Scripting (or PowerShell I suppose)

Something a bit more cross platform and ubiquitous...

  • Perl
  • Python
  • Ruby

...or something more build oriented.

  • Make
  • Rake


I'd be interested in which bits of Ant you find useful - I presume it's the tasks and not the language itself, or the declarative bit of Ant. If that's true, I'd suggest Groovy, Jython or Jruby would let you wrap the Ant tasks in code that's more suitable for your needs, without a line of XML.


you can leverage existing ant scripts, and switch to groovy!

using http://groovy.codehaus.org/Using+Ant+from+Groovy


And there is always the shell ... sh, batch or WSH or Powershell or if you have it: Python, Perl etc. can get you quite far.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜