personal automation example: deleting a local maven artifact

I want to start recording the benefits I get out of personal and local (team-level) automation.

When I have a local version of a maven library installed, say 0.19.0-SNAPSHOT, but I want to go back to using the last released version, say 0.18.0, then I need to delete the library from my local maven repo. I’ve learned the hard way that it is not enough to delete the directory in the jar; I have to delete another file too. So a while back, I scripted that.

This tiny program deletes a version of the `rug` library, since that’s usually the one I’m messing with.


~/bin/delete-version
#!/bin/bash
set -eset -x
version=$1
cd ~/.m2/repositorycd com/atomist/rugls $1rm maven-metadata-local.xmlrm -r $version

This is in ~/bin/delete-version
Today I wanted to remove a version of different library, so I didn’t call the program, but I did look at it.

cat `which delete-version`
and then I said oh right. There is the directory to go to and there’s that other file I must delete. Even though I haven’t automated precisely what I want to do, my automation was useful. 
The only real documentation is code.