Scripting Timemachine exclusion lists
The tmutil command line tool, included with OS X, supports the ability to add and remove items from the exclusion list.

sudo tmutil addexclusion ~/.ivy2


See the tmutil manual page for more information about this tool's options.

As tmutil is a command line tool, it can be incorporated into AppleScripts using do shell script, combined with Automator workflows using the Run shell script step, or as part of a traditional shell script.