0

I'm trying to avoid having plain-text passwords in the server's configuration files. Being so, I want to use the gradle-credentials (https://github.com/etiennestuder/gradle-credentials-plugin) plug-in in order to obfuscate their value.

I already imported the necessary dependencies and am now able to create the "gradle.encrypted.properties" file with the encrypted passwords. My current problem is that when I try to run the gradle wrapper commands and apply the com.marklogic.ml-data-hub plug-in the DHF connects to the Application Server and fails before I am able to use the encrypted credentials.

I think that I am missing some detail, because the Marklogic documentation states that we can remove the password property from the gradle.properties file.

My build.gradle file contains the following:

buildscript {
  dependencies {
    classpath fileTree(dir: "ml-gradle-dependencies", include: "*.jar")
  }
}

apply plugin: "com.marklogic.ml-data-hub"
apply plugin: "nu.studer.credentials" 
apply plugin: "net.saliman.properties"
apply plugin: "java"
apply plugin: "idea"
apply plugin: "eclipse"

repositories {
    mavenLocal()
}

ext {
  mlManageConfig.password = credentials.mlPassword
  mlManageConfig.securityPassword = credentials.mlPassword // only needed if setting mlSecurityUsername

  mlAdminConfig.password = credentials.mlPassword

  println mlAdminConfig.password

  mlAppConfig.restAdminPassword = credentials.mlPassword
  mlAppConfig.appServicesPassword = credentials.mlPassword

  // Re-initialize the connections to the Admin and Manage servers
  mlManageClient.manageConfig=mlManageConfig
  mlAdminManager.adminConfig=mlAdminConfig
}

dependencies {
    // this allows you to write custom java code that depends
    // on the Data Hub Framework library

    compile 'com.marklogic:marklogic-data-hub:4.1.1'
    compile 'com.marklogic:marklogic-xcc:9.0.7'
}

And after I delete the mlPassword from the gradle.properties file I get the following error

Where: Build file 'C:\workspaces\CAPL\tmp\marklogic\dhf\build.gradle' line: 7

What went wrong: A problem occurred evaluating root project 'dhf'.

Failed to apply plugin [id 'com.marklogic.ml-data-hub'] No password provided

capl
  • 1
  • 2

1 Answers1

0

There is a page on this in the marklogic-gradle wiki:

https://github.com/marklogic-community/ml-gradle/wiki/Encrypting-passwords

The short answer is that there are existing plugins in the gradle ecosystem to manage passwords, and marklogic-gradle works with those as well.

  • Hi! Yes, I am using the plug-in mentioned in the page you referenced. My problem is that when I apply that solution and remove the "mlPassword" from the gradle.properties file I get a "No Password" error (even after I added the _ext_ block to my build.gradle script) – capl Jun 20 '19 at 07:55