4
votes

Hi I am trying to load xml document into marklogic using mlcpTask class from gradle. I am currently using - Marklogic version 10.0-1 - Gradle 6.5 - Java 14.0.1

Build.gradle file as below:

    plugins {
    id "com.marklogic.ml-gradle" version "4.0.3"
    id "net.saliman.properties" version "1.5.1"
      }

repositories {
  jcenter()
  maven { url "http://developer.marklogic.com/maven2/" }

}

configurations {
  mlcp
}

dependencies {
    mlcp "com.marklogic:mlcp:9.0.7"
    mlcp files("mlcp")
}

task loadDoc (type: com.marklogic.gradle.task.MlcpTask) {
  classpath = configurations.mlcp
  mode = "local"
  command = "IMPORT"
  database = mlAppConfig.contentDatabaseName
  input_file_path = "src/main/ml-data/SampleXML.xml"
  input_file_type = "documents"
  document_type = "xml"
  output_collections = "raw"
  //output_uri_prefix = "/document"
  output_uri_replace = "/C:/Users/Anshuman/Desktop/mlproject,''"
  //output_uri_suffix = ".xml"
}

Error which I am getting: PS C:\Users\Anshuman\Desktop\mlproject2> gradle loadDoc

Task :loadDoc FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':loadDoc'.

    The value for task ':loadDoc' property 'mainClass' is final and cannot be changed any further.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 810ms 1 actionable task: 1 executed

1
I can confirm Gradle versions 5.2.1 and 6.2.2 work as expected and the problem began with Gradle version 6.4.1.s3-4v
I'm doing some testing of Gradle versions with the example mlcp-project in ml-gradle. Sounds like some particular version of Gradle is not happy about how MlcpTask calls setMain.rjrudin

1 Answers

2
votes

Per the comment from s3-4v above, the issue starts with Gradle 6.4 - a ticket has been opened for this - https://github.com/marklogic-community/ml-gradle/issues/554 . Can use Gradle <= 6.3 in the meantime.