Monday, March 7, 2011

Workflow automation: Makefile vs. Ant

Whenever I notice that something in my workflow is a repeating task, I try to automate it.

For example the steps necessary to deploy something on a server. It's often a build, followed by a scp and finally some remote setup scripts:

  1. mvn package
  2. scp target/foobar.jar server:
  3. ssh server install-foobar
  4. ssh server './bin/foobar restart'

I tend to write a small Makefile in such cases, which could look like

  deploy:
      mvn package
      scp target/foobar.jar server:
      ssh server install-foobar
      ssh server './bin/foobar restart'

How do you automate your workflows?
Is Ant the tool of choice? What are the Pros/Cons?

From stackoverflow
  • Rake is my choice.

  • For Java development, I'd say Ant is the default choice.

    Pro:

    • good documentation,
    • good IDE integration
    • Lots of third-party extensions and tools

    Con:

    • Somewhat verbose (well, it's yet anothr XML format)
    • Some things that should be simple aren't (e.g. any kind of looping)

    I don't really have any experience using makefiles, so I can't say how they compare. Maybe you should simply use what your developers are more experienced with.

    Adam Peck : ant-contrib can be used to easily add loops to ant scripts.
  • I find Ant and its XML configuration syntax a bit unwieldy and there are some things that should be trivial but are very hard to get in Ant. I prefer for that kind of automation SCons.

    There is another tool precisely made to deploy stuff that I used for a bit and was pretty cool, but I forgot its name, maybe somebody else remembers it :).

  • SCons is another good one. And Capistrano seems to be well regarded although I haven't tried it.

  • I use shell and perl scripts

  • consider GAnt (http://gant.codehaus.org/). using Groovy's builder, it is much less verbose than an Ant build script

    PEZ : Ey, this look fantastic!
  • I use scripts (shell, perl, python) or makefiles. I do not like Ant and SCons

  • For python I tend to use fabric for the deployment steps and setuptools for any building that is needed (not that usual for me :-)

    Fabric understands how to copy files to servers, runing commands on the remote server (both as the standard user and as root).

0 comments:

Post a Comment