marklogic / ml-gradle

Gradle plugin for automating everything involving MarkLogic
Other
73 stars 77 forks source link

MlcpTask fails when switching to MarkLogic version 11.1.0 #682

Closed peetkes closed 8 months ago

peetkes commented 10 months ago

I upgraded my MarkLogic server from version 10 to version 11 and also used mlcp library for version 11

When I run my custom task of type com.marklogic.gradle.task.MlcpTask I get the following error:

> Task :loadSchemas FAILED
Execution optimizations have been disabled for task ':loadSchemas' to ensure correctness due to the following reasons:
  - In plugin 'com.marklogic.ml-gradle' type 'com.marklogic.gradle.task.MlcpTask' property 'classpath' cannot be resolved:  Could not resolve all files for configuration ':mlcp'. Reason: An input file collection couldn't be resolved, making it impossible to determine task inputs. Please refer to https://docs.gradle.org/7.6/userguide/validation_problems.html#unresolvable_input for more details about this problem.
mlcp arguments, excluding known password arguments: [IMPORT, -port, 8010, -output_uri_replace, .*data/schemas,'', -output_collections, /opera/options/schema, -input_file_pattern, .*\.(xsd|xml), -input_file_path, data/schemas/Release_A/schema, -output_permissions, schema-test-reader,read,schema-test-writer,update, -database, lvbb-stop-content, -host, localhost, -username, admin]

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':loadSchemas'.
> Could not resolve all files for configuration ':mlcp'.
   > Could not resolve com.google.guava:guava:32.1.2-jre.
     Required by:
         project : > com.marklogic:mlcp:11.1.0
      > Cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
          - androidRuntimeElements
          - jreRuntimeElements
        All of them match the consumer attributes:
          - Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre:
              - Unmatched attributes:
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
          - Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre:
              - Unmatched attributes:
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'standard-jvm' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
   > Could not resolve com.google.guava:guava:27.0-jre.
     Required by:
         project : > com.marklogic:mlcp:11.1.0 > org.apache.hadoop:hadoop-common:3.3.6
      > Cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
          - androidRuntimeElements
          - jreRuntimeElements
        All of them match the consumer attributes:
          - Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre:
              - Unmatched attributes:
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
          - Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre:
              - Unmatched attributes:
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'standard-jvm' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
   > Could not resolve com.google.guava:guava:16.0.1.
     Required by:
         project : > com.marklogic:mlcp:11.1.0 > org.apache.hadoop:hadoop-yarn-common:3.3.6 > com.google.inject:guice:4.0
      > Cannot choose between the following variants of com.google.guava:guava:32.1.2-jre:
          - androidRuntimeElements
          - jreRuntimeElements
        All of them match the consumer attributes:
          - Variant 'androidRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre:
              - Unmatched attributes:
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'android' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it
          - Variant 'jreRuntimeElements' capabilities com.google.collections:google-collections:32.1.2-jre and com.google.guava:guava:32.1.2-jre:
              - Unmatched attributes:
                  - Provides org.gradle.category 'library' but the consumer didn't ask for it
                  - Provides org.gradle.dependency.bundling 'external' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.environment 'standard-jvm' but the consumer didn't ask for it
                  - Provides org.gradle.jvm.version '8' but the consumer didn't ask for it
                  - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it
                  - Provides org.gradle.status 'release' but the consumer didn't ask for it
                  - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it

This can be resolved by adjusting the configurations part for mlcp. Origin (fail):

configurations {
  mlcp
}

New (success)

configurations{
  mlcp {
    attributes {
        attribute(TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE, objects.named(TargetJvmEnvironment.class, TargetJvmEnvironment.STANDARD_JVM))
    }
  }
}
rjrudin commented 8 months ago

Instructions for the correct Gradle config for MLCP are now in the ml-gradle docs and the example project - https://github.com/marklogic/ml-gradle/blob/master/examples/mlcp-project/build.gradle .