Skip to content

Commit 953e2f9

Browse files
committed
#454 Properly deleting a bundle directory
This has always been an issue with mlRestApi/mlBundle, but is more of a concern now that bundles include config files.
1 parent 0c25481 commit 953e2f9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/groovy/com/marklogic/gradle/task/client/PrepareBundlesTask.groovy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.marklogic.gradle.task.client
22

33
import com.marklogic.appdeployer.ConfigDir
44
import com.marklogic.gradle.task.MarkLogicTask
5+
import org.apache.commons.io.FileUtils
56
import org.gradle.api.artifacts.Configuration
67
import org.gradle.api.internal.project.DefaultAntBuilder
78
import org.gradle.api.internal.project.ant.AntLoggingAdapter
@@ -29,8 +30,13 @@ class PrepareBundlesTask extends MarkLogicTask {
2930
if ("mlRestApi".equals(configurationName)) {
3031
println "\nWARNING: mlRestApi is deprecated as of release 3.13.0, please use mlBundle instead, which is a drop-in replacement.\n"
3132
}
33+
3234
def buildDir = new File("build/" + configurationName)
33-
buildDir.delete()
35+
try {
36+
FileUtils.cleanDirectory(buildDir)
37+
} catch (Exception e) {
38+
println "Unable to delete directory: " + buildDir
39+
}
3440
buildDir.mkdirs()
3541

3642
// Constructing a DefaultAntBuilder seems to avoid Xerces-related classpath issues

0 commit comments

Comments
 (0)