marklogicml-gradle

Deploy a specific MarkLogic Database configuration using ml-gradle


Is there a CLI argument or parameter to deploy configuration of a particular database instead of deploying all the database configurations under src/main/ml-config/databases?

e.g. when I use the gradle mlDeployDatabases command, it deploys all the database configurations.

I am looking for an argument like -PmlDatabaseName=Database1 that lets me deploy just the Database1 DB.

gradle mlDeployDatabases -PmlDatabaseName=Database1


Solution

  • There are a couple of properties that can be used to either include or exclude resource files:

    https://github.com/marklogic-community/ml-gradle/wiki/Property-reference#other-resource-properties

    • mlResourceFilenamesToExcludeRegex New in 3.0.0 - regex that defines resource filenames to exclude from processing (exclude = ignore). Useful for when you want to exclude a set of resources when deploying to a certain environment. Cannot be set when mlResourceFilenamesToIncludeRegex is also set. No default value.
    • mlResourceFilenamesToIgnore Comma-separated list of resource filenames that should be ignored and not deployed. Useful for when different environments require different resources to be deployed. No default value.
    • mlResourceFilenamesToIncludeRegex
      New in 3.0.0 - regex that defines resource filenames to include. If a filename doesn't match this regex, then it will be excluded (ignored). Cannot be set when mlResourceFilenamesToExcludeRegex is also set. No default value.

    If your "Database1" file was "Database1.json", then something like:

    gradle mlDeployDatabases -PmlResourceFilenamesToIncludeRegex=Database1.json