Hudson - How can I do a "SVN clean up"? Hudson - How can I do a "SVN clean up"? jenkins jenkins

Hudson - How can I do a "SVN clean up"?


If your build is done correctly, you should be able to simply do use 'svn update as much as possible. This is the fastest way to update your files. This means not modifying committed files, or placing build artifacts in directories where they will interfere with the build process. In a Java shop, simply keeping all built objects in a subdirectory (we use target to match Maven, but others use build or diet) and out of the way of the rest of the process.

Most people do a clean as part of their build step. This, in theory, should not be necessary, and doing so will lengthen build times. The idea of the build is not to do any unnecessary work. If a source file isn't changed, the corresponding object file should not need to be rebuilt. However, Java is pretty fast at compiling, that most Java projects simply wipe the build directory clean. In C projects, not deleting old objects is better since it really reduces build time.

If there is a problem with your build process where use 'svn update' as much as possible can't work, you should fix your build process. However, there are a couple of projects on our old Jenkins server that do have problems, and they simply aren't updated enough to worry about it. For those, I do Always checkout a fresh copy. This takes the longest, but if you're having problems with your build process, I wouldn't bother using emulate a clean checkout by first deleting unversioned/modified files and use svn revert first. These can cause update conflicts, and cause problems with your build. Either get the build working correctly, or do a clean checkout.


I would go with "Use svn update as much as possible, with 'svn revert' before update". If that is not sufficient, check out the EnvInject Plugin. It can run a script before the SCm checkout happens. You can use it to run a svn cleanup for your job, before the Subversion plugin takes over with the revert and the update. Caveat, you need to install some kind of SVN command line client on your build server.