How To Misuse Ant 68

Posted by Ben Rady Wed, 06 Jun 2007 03:03:00 GMT

Professional software developers can and should maintain their own build system. We strive to deliver working software, not source code. However, if you want to shirk this responsibility, and you’re a Java programmer, and you use Ant, then there is a way out.

The first step is make your build so complex, brittle, and hard to use that nobody else can even build with it, much less maintain it. Here are some well-worn techniques:

Use Ant Like An Imperative Programming Language

Make heavy use of the if and unless attributes, and try to create lots of conditional properties. Chain them together if you can. Try to get it so that it’s impossible to get anything to work without setting at least a dozen different properties from the command line. When you find yourself needing a loop structure, you know you’re on the right track.

Create Useless Default Targets

Useful default targets make it too easy. Make sure you do something that will fail after a clean checkout. And don’t use the standard build.xml filename…otherwise people will be able to build simply by calling ant. Name your build file cibld.v2 or something obscure like that.

Make One Big Target That Does Everything

Just as decoupling and encapsulating your code makes it simpler, decoupling and encapsulating actions in your ant script makes it much easier to read and use…avoid this at all costs. Put everything into one big target that cleans, builds, makes JavaDoc, deploys, runs FindBugs, emails you that it’s done, prints the results to the office printer, and reboots the build machine just for luck.

Don’t Use Metatargets; Use the depends Keyword Instead

A corollary to the OneBigTarget rule is the avoidance of metatargets. By making lots of small targets that do one thing well, you introduce the possibility of chaining them together to do different operations. These “metatargets” allow people to use the build in ways you never anticipated. What horror! Things must be done the way you define them back when you originally wrote the script. Why would anyone have the arrogance to do it another way?

If you have to decouple into small targets, make sure you chain them all together using the depends keyword. It’s almost as good as the OneBigTarget.

Avoid Self-Documentation

When creating a target, don’t give it a useful or informative name. Be sure not to use the description annotation for your targets. This can be used with the -projecthelp option in ant to print out a list of public targets and their uses! How will ever confuse people like that?

Never Refactor Your Scripts

Finally, if you do have to change something (although I can’t imagine why that would ever be necessary), make sure you leave all your old stuff in there. Granted…the source control system is probably tracking all of your changes, but you can never be too sure. It’s best to just leave all those old, crusty targets in there. It’ll confuse everyone else, and it makes it easier for your to find your old stuff without learning how to use subversion.

Once all of this complexity is in place, you’re ready for the big payoff. It was a lot of work up front, but it’s worth it, because now you can argue to your boss that build management is way too hard for you do to all by yourself. Point out that you’ve been spending 30 hours a week on the build and you should have no problem talking him into hiring a build guy to do it for you. Voila! No more build system headaches for you. Just don’t be surprised if, during the next round of layoffs, the build guy keeps his job (how could we manage without him?!?) while yours is shipped off to India.

Of course, if you DO want to maintain your own build system, you can start with a lot worse than my Nifty Thrifty Build Script

Comments

Leave a response

  1. Avatar
    johnson2542@yahoo.com 2 days later:

    Here’s one more idea: You can write own ant-task, which takes lots of parameters, does some calculation – for example dependency calculation, and if decides, executes targets in the calling build.xml (these will be targets, which are never referenced from the buildfile, but only from the task). It’s advicable to keep sources of the ant-task in a completely different location, and distribute buildfile together with the compiled jar (additionally you can obfuscate the jar )

    ;)

  2. Avatar
    Jeff L. 3 months later:

    How about, “call batch/shell script files from ant, which in turn call ant itself?”

  3. Avatar
    galbur over 3 years later:

    which are never referenced from the buildfile, but only from the task

  4. Avatar
    online mafya oyunu over 3 years later:

    emails you that it’s done, prints the results to the office printer, and reboots the build machine just for luck.

  5. Avatar
    cheap vps over 3 years later:

    Finally, if you do have to change something (although I can’t imagine why that would ever be necessary), make sure you leave all your old stuff in there. Granted…the source control system is probably tracking all of your changes, but you can never be too sure. It’s best to just leave all those old, crusty targets in there. It’ll confuse everyone else, and it makes it easier for your to find your old stuff without learning how to use subversion.cheap VPS

  6. Avatar
    website reviews over 3 years later:

    hello there. how to misuse ants is an impressive article. its always a relief to find a way out. and your suggestions is convincing. i agree ith you that by making the program more and more complex beyond someone other then the insider to understand to maintain it and build like that program is convincing. and your worming techniques are handy. i don;t know much about th programming but as a general reader i found this post to be worthy. thanks for the post.

    website reviews

  7. Avatar
    Ray Cruz over 3 years later:

    Very start, I’d prefer to tell thanks to you for this informative article. Lastly, I’d prefer to wonder wherever I can attain a lot more data regarding your article. I arrived right here through Bing & i can not check any linked up web internet sites on this subject. How do I sign for your web blog? I’d choose to adhere to your updates as they arrive along! I had a query to question but I forgotten what it absolutely was… anyway, thanx. Author of how to cook beef tenderloin

    Sincerely, Ray Cruz
  8. Avatar
    fatmagülün suçu ne izle over 3 years later:

    Keep in mind that although we typically know what the effects of two or more drugs have the mechanism

  9. Avatar
    online personal fitness over 3 years later:

    Awesome, just what I was looking for. Thanks, Jake.

  10. Avatar
    chat over 3 years later:

    thanks for sharing

  11. Avatar
    Atlanta Hosting over 3 years later:

    “Avoid Self-Documentation” I liked this part. thanks

  12. Avatar
    moncler over 3 years later:

    Make sure you do something that will fail after a clean checkout. And don’t use the standard build.xml filename…otherwise people will be able to build simply by calling ant. Name your build file cibld.v2 or something obscure like that.

  13. Avatar
    shopping over 3 years later:

    Moncler is the renowned high-end outerwear Discount Moncler brand which created a quilted jacket trend in the fashion world. Never one to stand still in time,It has always kept abreast of the latest Moncler Jackets technologies and stayed true to its origins without compromising its Moncler runway worthy style. If it has a Moncler tag, it will keep you warm on top of the highest mountain and be Moncler Men’s trendy on any city street.Features the latest selection of the north face clothing. You will enjoy what you Moncler Women’s show you. As well we offer you the good shopping experience with cheap and discount price.

  14. Avatar
    shopping over 3 years later:

    Hermes Birkin Handbags are fashion icons regarded Hermes Handbags as much more than simple purses. They are status symbols, with waitlists forcing fashion fans to wait more than Hermes Birkin two years to own one.Hermes Birkin Handbags were created by Hermes head Jean Louis Dumas and actress Jane Birkin. Word is that Jean wanted a functional weekend bag, and so the Birkin was born. Now these Hermes Belts prestigious bags are seen on the arms of all the hottest celebs including Hermes Purses Victoria Beckham, Sarah Jessica Parker, and Oprah Winfrey.

  15. Avatar
    shopping over 3 years later:

    Herve Leger Bandage High Waist Mini Skirts It is very eye-catching. You can wear Discount Herve Leger it in your casual time,go to office, go shopping, as you like in every place. As we know ,Herve Leger Dresses comes from French ,and found in 1985,it is the most famous designer house ,it always go in for the women’s beautiful shaped 90% Rayon, 9% Nylon,1% Spandex Zipper Herve Leger Dresses closure please just follow the show on the label to maintain the beauty Dry clean only These designer Herve Leger Bandage Dress and Herve Leger Skirts are feminine and sensual,stand out.

  16. Avatar
    shopping over 3 years later:

    There is a brand that continues to turn out the Hermes Birkin seasons to seasons, yes, there is Hermes Handbags. In this season, there is bright colors. The hermes birkin replica,Birkin HandBags,hermes birkin purses are all in our warehouse.The Replica Hermes Birkin makes an effort to please the all Hermes 35CM Birkin Bags request by the masses. When you first come across with the Replica Hermes Belts the showroom, you instantly think that it is a Replica Hermes Birkin you would love to tote.

  17. Avatar
    shopping over 3 years later:

    Beginning as a professional Cheap Moncler Coats seller, We achieved great success in this field. Moncler Giubbotti have a pretty good team who have been devoting themselves into reducing the costs by constantly Moncler Uomo looking for a best and steadiest manufacturer.By the year 2006, we had expanded our line from Moncler Gilet Donna to a wider range, They are Moncler Outlet,Moncler Boots,Moncler Scarf,Moncler Giubbotto Uomo. From Outletmoncler.com,People all over the world enjoy buying stuff and give high praises.

  18. Avatar
    shopping over 3 years later:

    To have the Hermes birkin bag is becoming every woman’s dream.Though they have a hilarious collections of Replica hermes birkin,and others feminine accessories,but only few women are able to obtain it,because Cheap hermes handbags of the price,Since that it designed by the would’s most known designer,then the price reaches more ther hundreds Hermes Belts dollars for an item. If you are in such problem,loving the handbags,but have limited fund that Hermes Purses are far away from it’s price,then Replica Hermes Bags would your best solution.

  19. Avatar
    moncler online shop over 3 years later:

    if you are interestring with good quality of moncler jackets,clike this link

    href=”http://www.monclerwomenjacket.com”>moncler online shop

    good

    quality moncler coatsand discount,can save your money.click here to see

    href=”http://www.monclerwomenjacket.com”> moncler vest

  20. Avatar
    Pandora over 3 years later:

    on’t belittle or humiliate people who didn’t have the chance to learn how to write good code.

  21. Avatar
    Harrishcolin over 4 years later:

    Thank you for this nice post

    my blog: alpha male | how to run faster

  22. Avatar
    High Protein Foods over 4 years later:

    i agree ith you that by making the program more and more complex beyond someone other then

  23. Avatar
    Bucharest Apartments over 4 years later:

    It’s advisable to keep sources of the ant-task in a completely different location, and distribute buildfile together with the compiled jar

  24. Avatar
    Visual Impact Muscle Building Review over 4 years later:

    i just visit this site. this blog is very good and awesome. i read the post and know some information. thanks for sharing. already bookmarked.

  25. Avatar
    Truth About Quickness Review over 4 years later:

    Your article is extremely impressive. I never considered that it was feasible to accomplish something like that until after I looked over your post. You certainly gave a great perception on exactly how this whole process works. I will make sure to return for more advice. Thanks

  26. Avatar
    TactFit Commando Review over 4 years later:

    hank you for this blog. That’s all I can say. You most definitely have made this blog into something that’s eye opening and important. You clearly know so much about the subject, you’ve covered so many bases. Great stuff from this part of the internet. Again, thank you for this blog.

  27. Avatar
    Criminal Records over 4 years later:

    Put everything into one big target that cleans, builds, makes JavaDoc, deploys, runs FindBugs, emails you that it’s done, prints the results to the office printer, and reboots the build machine just for luck.

  28. Avatar
    iPhone SMS to Mac Backup over 4 years later:

    Thanks for shareing! I agree with you. The artical improve me so much! I will come here frequently. Would you like to banckup iphone SMS to mac, macBook, macbookPro as .txt files? Now a software iphone SMS to Mac Backup can help you to realize it.

  29. Avatar
    dswehfhh over 4 years later:

    We are the professional jacket manufacturer, jacket supplier, jacket factory, welcome you to custom jacket.

  30. Avatar
    vibram bikila blue over 4 years later:

    Vigilance is also needed in the Justice and Development Party (PJD), an Islamist party that has forty-six seats in the House of Representatives. “The outlines are very good, but the result will be assessed bikila womens[/url] bikila 43 mens[/url] bikila 44 mens[/url] bikila mens[/url]once the changes have been completed and will be known,” said Abdullah Daha, first vice-secretary. The PJD and awaits with great interest that the project should make the commission in June, but demand to be represented. “We will be available anyway because the king invited the Committee to consult the various components of the nation,” he says.

  31. Avatar
    jaychouchou over 4 years later:

    To be, or not to be- that is a question.Whether ipad bag tis nobler in the mind to suffer The slings and Game Controllers arrows of outrageous fortune Or to take arms against a sea of troubles, And USB Gadgets by opposing end them.TT

  32. Avatar
    johnm over 4 years later:

    There is lot of tutorial about ant scripting.It’s quite easy to learn though. Lower Back Pain Treatment

  33. Avatar
    dory over 4 years later:

    This was a really fantastic post that I really do appreciate. This is something that is really amazing and interesting to me to say the least. Social Network

  34. Avatar
    Big pony over 4 years later:

    Thanks for your share,thanks a lot.Good luck!

  35. Avatar
    Big pony over 4 years later:

    Wow, this is too cool. I am very like it, Thank you for sharing

  36. Avatar
    okey oyunu oyna over 4 years later:

    this is very nice…

    Okey oynamak hiç bu kadar zevkli olmadi. Online ve 3 boyutlu okey oyunu oyna ve turnuvalara sende katil.

  37. Avatar
    custom made playing cards over 4 years later:

    great Information… Thnaks for posting it… It was very helpful..

  38. Avatar
    ford leveling kit over 4 years later:

    Your article is so informative I really like it Thanks :-)

  39. Avatar
    leveling kit ford over 4 years later:

    Wonderful blogs and I really love it Thanks :-)

  40. Avatar
    leveling kit f250 over 4 years later:

    Your article is so informative I really like it Thanks :-)

  41. Avatar
    Bowtrol over 4 years later:

    hmm ,i’m not sure if this is what i’m looking for but anyway this is interresting and could be useful some day,thanks for taking time to write such cool stuff

  42. Avatar
    http://www.runningshoes2usa.com/Oakley-Sunglasses/index_1.html over 4 years later:

    Three days later, he discovered that this flea also jumps in there. one week later discovered that this pitiful flea has not only stopped in this drinking glass jumps – - it already to be actually unable to jump out this drinking glass.

  43. Avatar
    Dr.Dre Headphones UK over 4 years later:

    Nice post.Thank you for taking the time to publish this information very useful!I’m still waiting for some interesting thoughts from your side in your next post thanks.

  44. Avatar
    a href="http://www.womenuggmini.com/">women ugg mini</a> over 4 years later:

    still waiting for some interesting

  45. Avatar
    Ashley Bowling over 4 years later:

    The Qing Dynasty, which lasted until 1912, was the last dynasty in China.

  46. Avatar
    chy over 4 years later:

    Burberry Outlet September big AD movie has just been published, they cooperates with models Amber Anderson, Matthew Whitehouse, Edie Campbell and Rob Pryor. The model Matthew Whitehouse appears in Burberry AD movie for the second time. The theme is Burberry Nude Color, which derived from the sexy elements of Burberry New Arrival Women Perfume in the nice 1960s.in Burberry UK Prorsum September AD movie, men and women models wear in nude color together, it seems that nude element will become the new fashion focus in this year. The nude color lambs coats wore by models, looks so elegant and exquisite. Burberry offers platform for designers to show literary or artistic talent as always, and combine itself with British artists, weather and music.This season, Burberry Nude Collection is iconic Women Capsule Collection, the clothing are?Burberry Sale , the other kinds include Burberry Sunglasses, Burberry Watches, Burberry Bags, Burberry Shoes. The materials includes satins, sateen, silks, cashmere, lace, PU leather, fur, lambs and so on.

  47. Avatar
    discount louboutins over 4 years later:

    We are very happy to discount louboutins welcome Marine Vacth as a new ambassadress. Recognising emerging talent has always been part of the spirit of Yves Saint Yves Saint Laurent Pumps Laurent,” commented Deputy General Manager of Yves Saint Laurent, Nathalie Duran. “Marine charmed us Yves Saint Laurent Sandals with her grace and sparkling presence, as well as Yves Saint Laurent Slingbacks her determined and audacious personality.”

  48. Avatar
    otel over 5 years later:

    We got a grab a book from our area library but I think I learned more clear from this post.

  49. Avatar
    louis vuitton backpacks over 5 years later:

    of which the lowest price is LV louis vuitton handbags clearance by series. The same series bag if pattern different price will vary considerably, one of the most cheap to Louis Vuitton Men Handbags calculate the most common coffee interwoven letters pattern, commonly known as “LV aging”, but if Louis Vuitton Monogram Handbags pattern is white colour or black colored interweave.

  50. Avatar
    moncler over 5 years later:

    Dream about a very unique and elegant these people indulge in watching utilizing MONCLER jackets are this moment fashion belly epoch. MonclerA simple sweetness when you attempt to do something, to generate unique personality and bold. Is jacket print manufacturer’s reputation for well-designed force enjoy your fashion sense and advantage that certainly forward main Companion.

    The charm and personality of our occurs before our body temperature gets to keep normal seasonal demand respect. To look at the fascinating dressing features can beMonkuredaun, unique. To fit the jacket provides most stylish much related to our Mongrel, adorable best inventions get current requirements most suitable for. Affects how you feel certainly generic to the mind, of its own. A high-quality stylish to wear the design-time.
  51. Avatar
    investment over 5 years later:

    This is a very well written articles. I will be sure to bookmarks it and return to read mores of your useful informations.

  52. Avatar
    bebek over 5 years later:

    Thank you for sharing. i like it.

  53. Avatar
    mbtshoe over 5 years later:

    Australia Beats By Dre Studio dr dre beats headphones beats studio beats pro beats solo hd pro headphones music Official store Monster Beats By Dre Pro

  54. Avatar
    youngbrown over 5 years later:

    Thanks for the information, I’ll visit the site again to get update information action figures

  55. Avatar
    air mens shoes over 5 years later:

    These are the which are abnormally audacious for all the claiming and additionally it’s the abounding abode in the market. Actuality are some accomplishment which are listed as follows.

  56. Avatar
    cheap air shoes over 5 years later:

    This area name has been bedeviled by ice – citizenry aegis acceptable to actuality are all bargain auction with acceptable affection,The has audacious it with acclimatized cushioning accession.

  57. Avatar
    cheap snapback hats over 5 years later:

    So they are added in use and they are of altered types such as the afterwards the holes and etc. in case you access beat this again you would to apperceive about the accomplishment of it.

  58. Avatar
    cheap snapbacks free shipping over 5 years later:

    Just a accordant wind breadth is tasted, added his own ferial dress, there is this year’s style!South Korea website of advance like hot cakes. Snapback is absolute attractive rivets,Version to algid nice, amore is absolute nice.

  59. Avatar
    wholesale snapbacks over 5 years later:

    Absolute fashionable activity & alfresco achievement reviews at jcpenney sports fan bazaar above day aircraft on accoutrement accouterment from a trusted name in retail they are the official.

  60. Avatar
    wholesale snapback hats over 5 years later:

    The aureate alternation design, the all-embracing actualization is absolute stylish.The absolute & amore of a absolute is absolute adequate amore production, in the summertime can ahead sisters sunshade,

  61. Avatar
    nfl cheap jerseys over 5 years later:

    Bloom sheep summertime actualization sunbonnet han edition, the adjustment is absolute great, not abandoned in the summertime beard aftereffect is nice, & the abstracts are absolute cap analysis nice, able feels absolute admirable admirable accurate & fresh.

  62. Avatar
    blank snapback hats over 5 years later:

    Oh snapbacks best & beginning afterwards achievement asked to amore miami calefaction snapbacks i absitively that i am action to alpha a alternation of the top 8 eastern and western arrangement accession.

  63. Avatar
    louboutin sales over 5 years later:

    How To Misuse Ant 62 hoo,good article!!I like the post!27

  64. Avatar
    bladeless fans over 5 years later:

    How To Misuse Ant 63 good post158

  65. Avatar
    mafya over 5 years later:

    That’s the scale of it. Oil will not last for that long, but just screw up the planet.

  66. Avatar
    Authorhouse over 5 years later:

    I can’t believe how much of this I just wasn’t aware of. Thank you for bringing more information to this topic for me. I’m truly grateful and really impressed.

  67. Avatar
    scarf hermes over 5 years later:

    What is love? They say love makes the world go round?

  68. Avatar
    girl cosplay over 5 years later:

    http://www.outfitscosplay.com/cosplay-accessories/one-piece-accessories Deluxe One Piece Accessories for Sale.Find your favorite characters and cosplay outfits from all the popular anime and games.

Comments