Rest service : http://host:8000/v1/config/resources/removeCollection?put:database=string&put:uris=string*
I want to deploy this REST service extension in MarkLogic using gradle. How can I deploy this?
Rest service : http://host:8000/v1/config/resources/removeCollection?put:database=string&put:uris=string*
I want to deploy this REST service extension in MarkLogic using gradle. How can I deploy this?
If you're already using ml-gradle
, you can add your implemented interface to marklogic\src\main\ml-modules\services
and deploy using the mlLoadModules
task. The mlCreateResource
task as part of the scaffolding would also add metadata in marklogic\src\main\ml-modules\services\metadata
.
I recommend looking at ml-gradle
. You can easily hook it up in gradle by adding a few lines, most importantly being:
plugins { id "com.marklogic.ml-gradle" version "4.0.4" }
As described in the readme, you can optionally follow that with invoking the mlNewProject
task, which will provide you with a useful scaffold structure for a typical ml-gradle project.
ML-gradle gives you access to all kinds of tasks, including one called mlLoadModules
to deploy source, and rest extensions. There is also a built-in task for removing collections in any database, called mlDeleteCollections
. You can look at the Task-reference to get a glimpse of all the tasks, or just run gradle tasks
.
HTH!
Two easy ways of plugin gradle to invoke REST API:
Method One: If you don’t have any
Project
just yet,
gradle.properties
file in which you define four parameters: host
, mlUsername
, mlPassword
, RestPort
build.gradle
file in the same folder:plugins {
id "com.marklogic.ml-gradle" version "4.0.4"
}
task FCdeleteCollections(type: com.marklogic.gradle.task.datamovement.DeleteCollectionsTask) {
………………..
collections = ["{collection-name}"]
}
[root@ ~] # gradle FCdeleteCollections
Method Two: If you already scaffolded the
Project
, in my opinion, it is safer to invoke one-time deletion task like this:
[root@ ~] # gradle -Pdatabase={db-name} mlDeleteCollections -Pcollections={collection-name}
My preference is to invoke such task through Java API | DMSDK.