After my previous problem with the build.xml
file supplied in the Ivy
tutorial I hit another issue that I thought I'd share. The default ant
build file given in the Ivy tutorial generates an example source file within
the ant file and then builds it. I, and I presume many others, based their
new ivy-aware projects on that file. It has the default targets for
downloading and installing ivy. Yeah. Problem is that one of the targets
looks like this:
<!-- ================================= | |
target: clean | |
================================= --> | |
<target name="clean" description="--> clean the project"> | |
<delete includeemptydirs="true" quiet="true"> | |
<fileset dir="${src.dir}" /> | |
<fileset dir="${build.dir}" /> | |
</delete> | |
</target> |
Can you see where this is going? Note where it says to delete the entire source directory. Yeah. That just happened to me.
I lost about half a week's work. It was my own fault. Because I'm a Perforce refugee and we've decided to try using git, I was more hesitant than usual about checking non-working code into my own code branch just because i wasn't so familiar with the git style of doing things. So while I was trying to get the ivy problems ironed out I ran ant clean which promptly deleted all my source code. All of it. Well, except the unit tests.
Please, let this be a lesson that I've learned so that you don't have to. While I accept that this was my fault, I can't help thinking that as a rule no build file should ever delete the entire contents from the src directory, particularly not one shipped as part of a tutorial that one would attempt on existing code.