Skip to content

Commit b93bbf3

Browse files
committed
#483 Fixed typo in mlUnitTest task description
Also improved how existing results directory is deleted
1 parent f449328 commit b93bbf3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ class MarkLogicPlugin implements Plugin<Project> {
312312
"Can use -PsuiteName to override the name of the test suite, and -PtestName to override the name of the test module.")
313313
project.task("mlUnitTest", type: UnitTestTask, group: unitTestGroup, description: "Run tests found under /test/suites in the modules database. " +
314314
"Connects to MarkLogic via the REST API server defined by mlTestRestPort (or by mlRestPort if mlTestRestPort is not set), and uses mlRest* properties for authentication. " +
315-
"Use -PunitTestResultPath to override where test result files are written, which defaults to build/test-results/marklogic-unit-test. " +
315+
"Use -PunitTestResultsPath to override where test result files are written, which defaults to build/test-results/marklogic-unit-test. " +
316316
"Use -PrunCodeCoverage to enable code coverage support when running the tests. " +
317317
"Use -PrunTeardown and -PrunSuiteTeardown to control whether teardown and suite teardown scripts are run; these default to 'true' and can be set to 'false' instead. ")
318318

src/main/groovy/com/marklogic/gradle/task/test/UnitTestTask.groovy

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import com.marklogic.gradle.task.MarkLogicTask
55
import com.marklogic.test.unit.DefaultJUnitTestReporter
66
import com.marklogic.test.unit.JUnitTestSuite
77
import com.marklogic.test.unit.TestManager
8+
import org.apache.commons.io.FileUtils
89
import org.gradle.api.GradleException
910
import org.gradle.api.tasks.TaskAction
1011

@@ -73,9 +74,11 @@ class UnitTestTask extends MarkLogicTask {
7374

7475
File resultsDir = new File(resultsPath)
7576
if (resultsDir.exists()) {
76-
boolean deleted = resultsDir.deleteDir()
77-
if (!deleted) {
78-
println "Unable to delete test results directory: " + resultsPath
77+
try {
78+
FileUtils.cleanDirectory(resultsDir)
79+
println "Deleted existing results directory: " + resultsDir
80+
} catch (Exception e) {
81+
println "Unable to delete test results directory: " + resultsDir
7982
}
8083
}
8184
resultsDir.mkdirs()

0 commit comments

Comments
 (0)