tags:

views:

633

answers:

3

I have a Hudson CI server which is building a making a maven build. A parent project with two sub projects. One of maven subprojects creates a rather large .war (10MB) file which is stored for every build. I'd like to get rid of that .war file to save disk space, but I'd like to store everything else the Hudson build stores in history (test results, graphs etc.).

The .war file is stored under jobs/PROJECT_NAME/modules/PACKAGE_NAME$SUB_PROJECT_NAME/builds/2009-12-23_11-59-11/archive/PACKAGE_NAME/SUB_PROJECT_NAME/1.0/SUB_PROJECT_NAME-1.0.war

I have tried using job configuration according to this SO question namely Archive the artifacts and Discard all but the last successful/stable artifact to save disk space. But that actually does following:

  1. An additional copy is stored for two last build under jobs/PROJECT_NAME/builds/2009-12-29_17-23-39/archive/PROJECT_NAME/web/target/PROJECT_NAME-web-1.0.war . So it actually increases disk space consumption a bit.
  2. Web page for this hudson jobs contains links to .war files in the two last builds.

My build just executes clean install goals against parent pom.xml.

So how to configure Hudson server and/or Maven to remove build artifacts automatically from under jobs/PROJECT_NAME/modules and leave them under jobs/PROJECT_NAME/builds?

+6  A: 

i use post build task to do some files copy/delete stuff

Ben
+2  A: 

I ran into this issue a while back, and just went with a cronjob:

10 * * * *  find jobs/PROJECT_NAME/modules/ -name "*[tejw]ar" -type f -exec rm -f {} \;

Once per hour, it will delete all tar, ear, war, and jar files from this directory (and any subdirectories). There might be a more Hudson-centric way way of doing it...

matthewsteele
A: 

I came here with a similar question; my issue was resolved with the "Delete Old Builds" checkbox. If you don't care about preserving old build data like the OP does, this checkbox is a simpler solution.

piepera