diff --git a/build.gradle b/build.gradle index c7050bcd5..652dd0a22 100644 --- a/build.gradle +++ b/build.gradle @@ -24,11 +24,6 @@ targetCompatibility = "1.7" repositories { jcenter() - - // Needed for mlcp and its Hadoop dependencies - maven {url "http://developer.marklogic.com/maven2/"} - maven {url "http://repository.cloudera.com/artifactory/cloudera-repos/" } - mavenLocal() // Used for local development only } @@ -87,11 +82,11 @@ pluginBundle { displayName = 'ml-gradle for MarkLogic' description = 'Gradle plugin for configuring and deploying applications to MarkLogic' tags = ['marklogic'] - version = "2.3.2" + version = "2.3.3" } } mavenCoordinates { - version = "2.3.2" + version = "2.3.3" } } diff --git a/examples/mlcp-project/build.gradle b/examples/mlcp-project/build.gradle index 159fe9f71..f7ef9bfd9 100644 --- a/examples/mlcp-project/build.gradle +++ b/examples/mlcp-project/build.gradle @@ -4,10 +4,18 @@ * JavaExec task that exposes a number of mlcp arguments as task attributes. */ -plugins { - id "com.marklogic.ml-gradle" version "2.3.0" +buildscript { + repositories { + jcenter() + mavenLocal() + } + dependencies { + classpath "com.marklogic:ml-gradle:2.3.3" + } } +apply plugin: "com.marklogic.ml-gradle" + repositories { jcenter() @@ -92,7 +100,7 @@ task importSemicolonDelimitedText(type: com.marklogic.gradle.task.MlcpTask) { input_file_type = "delimited_text" output_uri_replace = ".*data,'/'" output_permissions = "rest-reader,read,rest-writer,update" - args = ["-delimiter", ";"] + delimiter = ";" } /** @@ -109,5 +117,5 @@ task exportSampleData(type: com.marklogic.gradle.task.MlcpTask) { password = "admin" // defaults to mlRestAdminPassword, which defaults to mlPassword database = mlAppConfig.contentDatabaseName output_file_path = "data/export" - args = ["-collection_filter", "sample-import"] + collection_filter = "sample-import" } diff --git a/gradle.properties b/gradle.properties index 1923c7ddf..d912fec04 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.marklogic -version=2.3.2 +version=2.3.3 mlAppDeployerDependency=com.marklogic:ml-app-deployer:2.3.0 -mlcpUtilDependency=com.marklogic:mlcp-util:0.2.0 +mlcpUtilDependency=com.marklogic:mlcp-util:0.3.0 diff --git a/src/main/groovy/com/marklogic/gradle/task/MlcpTask.groovy b/src/main/groovy/com/marklogic/gradle/task/MlcpTask.groovy index 1ec57ea45..3222b1a5b 100644 --- a/src/main/groovy/com/marklogic/gradle/task/MlcpTask.groovy +++ b/src/main/groovy/com/marklogic/gradle/task/MlcpTask.groovy @@ -10,13 +10,13 @@ import com.marklogic.appdeployer.AppConfig /** - * Provides parameters for some, but not all, mlcp arguments. Arguments that aren't supported can be passed in - * via JavaExec's "args" property. The main benefit of using this class is that it assumes usage of the connection - * properties found in the mlAppConfig project property. - * - * Note that this defaults to using appConfig.restAdminUsername and appConfig.restAdminPassword. That user may not + * Delegates properties to an instance of MlcpBean, which has properties for all MLCP arguments (and if it's out of date + * and missing one, you can pass them via this class's args property that's inherited from JavaExec). This task + * will also default the host/port to the values defined in the mlAppConfig instance populated by the plugin. + * + * Note that this defaults to using appConfig.restAdminUsername and appConfig.restAdminPassword. That user may not * have permission to perform the mlcp operation you wish to perform. In that case, just set the username/password - * parameters of this task for the appropriate user. + * parameters of this task for the appropriate user. */ class MlcpTask extends JavaExec { @@ -61,11 +61,25 @@ class MlcpTask extends JavaExec { } } - println "mlcp arguments, excluding password: " + newArgs - + // Ensure connection arguments are present + if (!newArgs.contains("-host")) { + newArgs.add("-host") + newArgs.add(config.getHost()) + } + if (!newArgs.contains("-port")) { + newArgs.add("-port") + newArgs.add("8000") + } + if (!newArgs.contains("-username")) { + newArgs.add("-username") + newArgs.add(config.getRestAdminUsername()) + } + + println "mlcp arguments, excluding password: " + newArgs + newArgs.add("-password") newArgs.add(password ? password : config.getRestAdminPassword()) - + setArgs(newArgs) super.exec()