You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mads Hansen edited this page May 9, 2017
·
5 revisions
As discussed in Writing your own management task, you can easily add new Gradle tasks to do anything that you would like with the MarkLogic Management API.
But, in some cases, you'll want to insert new steps in the middle of the deployment process as executed by "gradle mlDeploy". This task invokes the "deploy" method on an instance of AppDeployer, which defaults to SimpleAppDeployer. SimpleAppDeployer invokes a list of Command objects in an order based on the "getExecuteSortOrder" method defined in that interface. Thus, to add a new step to the deployment process, you just need to do the following:
Create a new implementation of the Command interface. You can do this inline in your Gradle build file, or you can define it as a class file in your Gradle buildSrc directory. You may want to start by subclassing AbstractCommand.
Add an instance of your Command implementation to the SimpleAppDeployer that's created by MarkLogicPlugin.
Now, when you run "gradle mlDeploy", your command will be executed. If you need to perform some cleanup work during "gradle mlUndeploy", then just make your Command implementation implement UndoableCommand.