I need to set an ml-gradle property (mlModulesDatabaseName) within the build script itself. I was under the impression that the gradle-y way to do that was to use the extra modules extension:
ext {
mlModulesDatabaseName = 'Modules'
}
This seems to place the value inside the project.properties map as it would if it was read from the gradle.properties, but its doesn't seem to target the correct database when I attempt to run the mlReloadModules task:
$ ./gradlew mlReloadModules -Pdev
:mlDeleteModuleTimestampsFile
:mlClearModulesDatabase
Clearing modules database
Logging HTTP response body to assist with debugging: {"errorResponse":{"statusCode":"404", "status":"Not Found", "messageCode":"XDMP-NOSUCHDB", "message":"XDMP-NOSUCHDB: xdmp:database(\"my-app-modules\") -- No such database my-app-modules"}}
Unable to clear database; cause: 404 Not Found
Finished clearing modules database
:mlPrepareRestApiDependencies
:mlLoadModules
:mlReloadModules
BUILD SUCCESSFUL
This may be ignorance of how gradle scopes its properties on my part, but you would think this would work. Any suggestions on how to pull this off?
As far as i can remember ml-gradle
reads properties immediately after being applied as a plugin. This means all changes to properties after this line
apply plugin: "com.marklogic.ml-gradle"
have no effect. Have you tried setting your ext
properties before applying the ml-gradle
plugin?
Edit: Another way to set custom properties is to set them like this:
ext {
mlAppConfig {
modulesDatabaseName = 'Modules'
}
}
This also works after the apply plugin
line.