Skip to content

Commit b15fce4

Browse files
committed
#251 MlcpTask should use args instead of additionalOptions
1 parent 965fa5b commit b15fce4

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

examples/mlcp-project/build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,22 @@ task importSampleData(type: com.marklogic.gradle.task.MlcpTask) {
6969
classpath = configurations.mlcp
7070
command = "IMPORT"
7171
database = mlAppConfig.contentDatabaseName
72-
input_file_path = "data/import"
7372
output_collections = "sample-import"
7473
output_permissions = "rest-reader,read,rest-writer,update"
7574
output_uri_replace = ".*import,'/import'"
75+
7676
/**
7777
* New in ml-gradle 2.6.0 - set this to define a URI in your content database for mlcp's log output to be written to
7878
* as a text document. This can also be a variable, Gradle property, etc.
7979
*/
8080
logOutputUri = "/slappy.txt"
81+
82+
/**
83+
* The args array can be used for any MLCP parameters that are not supported by the MlcpBean class that MlcpTask
84+
* delegates to. input_file_path is supported by MlcpTask; this is just included as an example of using the args
85+
* array.
86+
*/
87+
args = ["-input_file_path", "data/import"]
8188
}
8289

8390
/**

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=com.marklogic
2-
version=3.1-alpha4
3-
mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.1-alpha4
2+
version=3.1-alpha5
3+
mlAppDeployerDependency=com.marklogic:ml-app-deployer:3.1-alpha5
44
mlcpUtilDependency=com.marklogic:mlcp-util:0.3.0
55

src/main/groovy/com/marklogic/gradle/task/MlcpTask.groovy

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class MlcpTask extends JavaExec {
5757
case ["class", "logger", "command", "password"]:
5858
// skip for now
5959
return
60+
case "additionalOptions":
61+
// Not supported by this task; use JavaExec's args instead
62+
return
6063
default:
6164
propVal = val
6265
break
@@ -84,16 +87,16 @@ class MlcpTask extends JavaExec {
8487
}
8588
}
8689

90+
// Include any args that a user has configured via the args parameter of the Gradle task
91+
newArgs.addAll(getArgs())
92+
8793
println "mlcp arguments, excluding password: " + newArgs
8894

8995
if (!isCopy) {
9096
newArgs.add("-password")
9197
newArgs.add(password ? password : config.getRestAdminPassword())
9298
}
9399

94-
// Include any args that a user has configured via the args parameter of the Gradle task
95-
newArgs.addAll(getArgs())
96-
97100
setArgs(newArgs)
98101

99102
File logOutputFile = null

0 commit comments

Comments
 (0)