Skip to content

How ml gradle works

Mads Hansen edited this page May 9, 2017 · 3 revisions

From a high level, here's how ml-gradle works:

  1. ml-gradle is a Gradle plugin, so when you apply it in your Gradle file - e.g. "apply plugin: 'ml-gradle'" - Gradle looks for a plugin class to execute.
  2. The ml-gradle plugin class is MarkLogicPlugin, which we'll refer to as "MLP".
  3. MLP has two main jobs - initialize a set of objects from the ml-app-deployer library, and initialize a set of tasks which you can view by running "gradle tasks". ml-gradle doesn't really do much at all - it's a thin, Gradle-specific layer that exposes all the useful functionality in ml-app-deployer. ml-app-deployer has no dependency on ml-gradle so that it can be used in any environment.
  4. The most important object initialized by MLP is an instance of SimpleAppDeployer under the Gradle property name "mlAppDeployer". MLP adds a few dozen different commands from ml-app-deployer; these commands are invoked when you run "gradle mlDeploy" and "gradle mlUndeploy".
  5. MLP also applies all the properties in gradle.properties - see Configuring ml-gradle for more info on this. When you run gradle with the "-i" or "--info" parameter, you'll see all the properties that are applied.
  6. Once Gradle has finished executing MLP, all the ml-app-deployer objects and tasks are ready for use.

A huge benefit of Gradle is that you can write any Groovy code you want in build.gradle, so you can make ml-gradle do just about anything you want to do - see the FAQ in this project for more info on extending ml-gradle.

Clone this wiki locally