diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b62b0968d..6f95692d3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip diff --git a/src/main/groovy/com/marklogic/gradle/task/MarkLogicTask.groovy b/src/main/groovy/com/marklogic/gradle/task/MarkLogicTask.groovy index a6395ec6b..04ab5e851 100644 --- a/src/main/groovy/com/marklogic/gradle/task/MarkLogicTask.groovy +++ b/src/main/groovy/com/marklogic/gradle/task/MarkLogicTask.groovy @@ -44,21 +44,29 @@ class MarkLogicTask extends DefaultTask { project.hasProperty("mlAdminPassword") ? project.property("mlAdminPassword") : project.property("mlPassword") } + DatabaseClient newClient() { + newClient(null) + } + /** - * If the "database" property is set, then the DatabaseClient that's returned will use the App-Services port - * (defaults to 8000) to connect to the given database. Otherwise, the DatabaseClient will try to connect to the - * REST API server defined by mlRestPort. + * If the "database" property is set or is passed as a parameter, then the DatabaseClient that's returned will use + * the App-Services port (defaults to 8000) to connect to the given database. Otherwise, the DatabaseClient will + * try to connect to the REST API server defined by mlRestPort. * @return */ - DatabaseClient newClient() { - if (project.hasProperty("database")) { + DatabaseClient newClient(String database) { + if (database != null){ + println "Connecting via the App-Services port to database: " + database + return getAppConfig().newAppServicesDatabaseClient(database) + } + else if (project.hasProperty("database")) { println "Connecting via the App-Services port to database: " + project.property("database") return getAppConfig().newAppServicesDatabaseClient(project.property("database")) } else { getAppConfig().newDatabaseClient() } - } + } void deployWithCommandListProperty(String propertyName) { deployWithCommands(getProject().property(propertyName)) diff --git a/src/main/groovy/com/marklogic/gradle/task/databases/DeleteUserSchemasTask.groovy b/src/main/groovy/com/marklogic/gradle/task/databases/DeleteUserSchemasTask.groovy index 03b58ed2e..8f690209b 100644 --- a/src/main/groovy/com/marklogic/gradle/task/databases/DeleteUserSchemasTask.groovy +++ b/src/main/groovy/com/marklogic/gradle/task/databases/DeleteUserSchemasTask.groovy @@ -31,7 +31,7 @@ class DeleteUserSchemasTask extends MarkLogicTask { String fullQuery = "cts:uris((), (), " + xquery + ") ! xdmp:document-delete(.)" println "Deleting user schemas in database '" + database + "' via : " + fullQuery - def client = newClient() + def client = newClient(database) try { client.newServerEval().xquery(fullQuery).eval() } finally {