Thursday, January 7, 2010

ANT and CFBuilder

SO, I am an ANT Newbie. I noticed though that CFBuilder has ANT built in, which I thought was cool, I mean, I see blog posts and twitter posts about ANT, but I would have to say that I wasn't overly tempted to try it for myself. Well this is a new year, so I am pushing my boundaries.

Anyways, so I looked at ANT a bit last week, and found it intriguing. All the samples that were on the site though were for Java mostly (not a big surprise really, but I don't compile any code before deployment). So, I Monday, I sent out a Twit to see if there was anyone with a good CF reference for ANT to do the simple stuff. I just want to copy some files from one location to another, so I can test it and then deploy. Marc Esher sent me over to http://www.mxunit.org/ where he had done a presentation on ANT and CF for CFUnited.

I downloaded the zip file, and found the reference file I was looking for. I worked on it a bit, and then forgot about it as phone calls and emails pored in... damn first day back from vacation.

So, later in the day, I was working along in CFB and accidentally hit CTRL-B, and I got a lovely console message telling me that my Build File wasn't right, the build.xml gained focus in CFB and the line with the error was selected... Was I ever shocked. So, I opened the sample again, and set back to work at it. I am impressed, with ANT, as well as its integration to CFB.

CFB popped up a content menu with ANT Tasks that I could choose from as well as descriptions of each - just like it does for CF tags, nice. So, I trundled along (it took about 5 minutes to get it working exactly the way I want it to) and finished off my first build script, then I hit CTRL-B again, but on purpose this time. ANT just ran along and boom, all the files I had wanted moved, were moved. The ones I didn't weren't. I would have to say I was a little excited.

So, I will be doing some more digging into the ANT docs, and Marc's preso and sample code, as I know that ANT can handle FTP'ing as well, so that is my next step. Oh, and the step after that? Well CFB as a plugin to FB4 and see if I can't get my Flex applications to build when I run the ANT script. That way I can run the routine and have the SWF compile and move with the CFCs needed to power it. I guess I need to figure out a way to have options in ANT, so that I can select if I want to run a 'Release build' or maybe just update the SVN... all from the same build file..

You know the more I think about how cool ANT is, the happier I am that the CFBuilder team included it! (I have never been one to continually add plugins to Eclipse, so this is just so easy... I like easy!)

2 comments:

  1. Rob,
    Welcome to ANT. Maybe in a month you'll be wondering how you ever lived without it?

    To your question about doing multiple actions in the same ANT file: absolutely. You can define multiple "targets" (think "functions" in CF, sort of), and then in the ANT view in Eclipse, you can select the target you want to run and click the Play button to run it.

    Jim Priest gave a CFMeetup on ANT, which I would Strongly recommend you watch. The hour you spend on it will open up a lot of doors for you: http://experts.acrobat.com/p53858056/

    Good luck!

    ReplyDelete
  2. Check out Jim Priest's Ant/CF wiki http://www.thecrumb.com/wiki/ant

    ReplyDelete