added archives
diff --git a/vars/asfMavenTlpPlgnBuild.groovy b/vars/asfMavenTlpPlgnBuild.groovy
index eff183f..59d0bc1 100644
--- a/vars/asfMavenTlpPlgnBuild.groovy
+++ b/vars/asfMavenTlpPlgnBuild.groovy
@@ -46,6 +46,7 @@
     
     taskContext['failFast'] = failFast;
     taskContext['tmpWs'] = tmpWs;
+    taskContext['archives'] = params.archives
 
     Map tasks = [failFast: failFast]
     boolean first = true
@@ -205,6 +206,7 @@
               }
             }
           } catch (Throwable e) {
+            archiveDirs(taskContext.archives)
             // First step to keep the workspace clean and safe disk space
             cleanWs()
             if (!taskContext.failFast) {
@@ -224,3 +226,11 @@
     }
   }
 }
+
+def archiveDirs(archives) {
+  if (archives != null) {
+    archives.each { archiveFileName, pathToContent ->
+	  zip(zipFile: "${archiveFileName}.zip", dir: pathToContent, archive: true)
+    }
+  }
+}