tags:

views:

2686

answers:

5

I want to have a way to teach hudson to delete the complete workspace before doing a checkout & build. Is there a plugin which enables that?

+5  A: 

Under Source Code Management, expand the advanced properties and un-check "Use Update" (this option is present for me for CVS, not sure about all other SCM tools). This option controls if Hudson uses an "update" command to simply grab changed files from SCM, or if it checks out a new/clean copy from source control.

matt b
It's present for all the SCM tools
pugmarx
And, in addition, do a 'clean' (like: 'maven clean') to remove the previous build artifacts as well (in maven: the target folder)
Andreas_D
does that actually deletes the complete workspace? maven clean is not enough, I want to delete the local repository as well.
Mauli
You mean you want to delete the local Maven repository? If so, I think that falls outside of the scope of what Hudson will do for you
matt b
I configured a private maven repository, only used by this job, so it actually is located within the workspace.
Mauli
+1  A: 

Uncheck Use Update under SCM options AND use call maven's clean phase in your command.

MikeNereson
+1  A: 

Currently, each SCM plugin provides workspace cleanup functionality. Soon, core Hudson will have this capability, and the SCM plugins will migrate the setting to that core feature: issue 3966

Michael Donohue
great, thats what I meant.
Mauli
A: 

OK, now can I tell Hudson to clean the workspace immediately AFTER the build is complete? Not before the actual build, like unchecking the "Update" box does...

VicD
This should be a distinct stackoverflow question
Michael Donohue
A: 

I haven't used them yet, but AFAIK there are hudson-plugins available which allow batch scripts to run as pre- and post-build steps which could delete the directory. Check out: Manage Hudson -> Manage Plugins -> Available

zoechi