Ant vs. Java

Discussions

General J2EE: Ant vs. Java

  1. Ant vs. Java (2 messages)

    In the last months I used Ant a lot to build archives for our different deployment scenarios. As the things became more complex, I tried to do the same as I would do in any other language: reuse code, hide information, avoid redundancy, generalize solutions, etc. All these things are well supported in Java, but in Ant I found it sometimes difficult to do the same. Ant tasks are written in Java, but you use them in a xml scripting language. I understand that XML is perfect for self-describing hierachical data, but I feel it is not made for any kind of programming languages. It's even cumbersome to do quite simple control-flows. This I felt when using JSP-Tag-Libraries, and I do feel it again when using Ant. For things like generic iterations or using Eclipse metadata i had to integrate 3rd party tasks. I even wrote my own task for a special requirement. The bottom line for me is that Ant-Tasks are Java-Classes, so it would be obvious to write Build-Tasks in Java, too. Then I could use the whole power of Java's syntax to control the build. I could also use the strength of compile-time checking, code-completion, object-orientation and runtime-debugging. And every build-step that I design carefully would be a potential new Task for reusing. So why make a difference between developing new tasks (using existing tasks) and developing a new build-script (also using existing tasks)? How do you think about this?

    Threaded Messages (2)

  2. Re: Ant vs. Java[ Go to top ]

    you should try macrodefs (along with includes). You can also use your favorite scripting language embedded in your build files. these features are both available since 1.6. Also, you might want to check out the ant-contrib project. they're implementing many "missing" features that make ant more "programmable", such as if/else try/catch and other goodies. it's amazing how powerful ant becomes when you put these three together. Cheers, Eml (http://www.thekirschners.com/software/testare/testare.html)
  3. Re: Ant vs. Java[ Go to top ]

    you might want to check out the ant-contrib project. they're implementing many "missing" features that make ant more "programmable", such as if/else try/catch and other goodies.
    Yes, I already use the ant-contrib project for those missing control-features. I also use ant4eclipse for using the build-metadata from Eclipse (checking out project sets, retrieving the build-order, e.g.). I also make heavy use of sub-build-xxx.xml, which i call with ant-calls and parameters. My point is not that it couldn't be done in Ant... but don't we solve problems that we wouldn't have directly in Java? The ant4eclipse project for example has much more useful Classes that are not available as tasks... My discussion is more in the direction: Is XML resonable for pseudo-programming-languages, interpreted at runtime in Java, poor to debug?