java-client-api icon indicating copy to clipboard operation
java-client-api copied to clipboard

Gradle breaks my build marklogic-client-api is missing the Gradle .module file in Maven Central

Open thorntonrp opened this issue 2 years ago • 4 comments

Since moving to Gradle, the marklogic-client-api was published without it's .module file. This causes Gradle to break the build on some private repositories that proxy Maven central.

Details:

Now that you are building with Gradle, please, please, please make sure that you upload all the artifacts, including the .module file. Due to security settings on my company's Maven repository, which proxies Maven central, Gradle breaks the build when I try to use marklogic-client-api as a dependency. This is because it is missing the .module file in the Maven central repository. Artifactory's security causes this to return a 403 instead of the usual 404. It's a long story why Artifactory does this, but I can't change it because my company depends on the Artifactory security settings to protect sensitive repositories.

thorntonrp avatar Mar 07 '22 00:03 thorntonrp

My company is still getting this error because the file marklogic-client-api-<version>.module is not being published to Maven Central with its other build artifacts. This is not a problem with my company's build process, but with the MarkLogic project that publishes marklogic-client-api. Your Gradle build already produces this file automatically. It should only take a few minutes for someone to correct the publication process to upload the missing artifact to Maven Central. Are there any plans to fix this?

 > Could not resolve com.marklogic:marklogic-client-api:5.5.3.
    > Could not get resource 'https://repo.xxx.org/artifactory/mvn/com/marklogic/marklogic-client-api/5.5.3/marklogic-client-api-5.5.3.module'.
       > Could not GET 'https://repo.xxx.org/artifactory/mvn/com/marklogic/marklogic-client-api/5.5.3/marklogic-client-api-5.5.3.module'. Received status code 403 from server: Forbidden


thorntonrp avatar May 06 '22 22:05 thorntonrp

Running ./gradlew marklogic-client-api:generateMetadataFileForMainJavaPublication produces

{
  "formatVersion": "1.1",
  "component": {
    "group": "com.marklogic",
    "module": "marklogic-client-api",
    "version": "5.5-SNAPSHOT",
    "attributes": {
      "org.gradle.status": "integration"
    }
  },
  "createdBy": {
    "gradle": {
      "version": "6.7",
      "buildId": "7ketr66d4bhunpzbxnfn4p36xi"
    }
  },
  "variants": [
    {
      "name": "apiElements",
      "attributes": {
        "org.gradle.category": "library",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.jvm.version": 8,
        "org.gradle.libraryelements": "jar",
        "org.gradle.usage": "java-api"
      },
      "files": [
        {
          "name": "marklogic-client-api-5.5-SNAPSHOT.jar",
          "url": "marklogic-client-api-5.5-SNAPSHOT.jar",
          "size": 1641903,
          "sha512": "b8cd84fe0a3d9b96556603abc287190b88a93c7cf53c42f3d8e75b10185d550346f087d3ee46b25ce50a46ddbbaa3f94bb24a9f1f83f1da2d321ec82057c58a9",
          "sha256": "e72ad489ccd3bf13db25a4f9c170d6ce56b0fcdd9f24abaae4c988f514b7ab63",
          "sha1": "2659ae54157fb2fd90d4c7267505ab6042760714",
          "md5": "c622b6f075a0d75250853febf42d4458"
        }
      ]
    },
    {
      "name": "runtimeElements",
      "attributes": {
        "org.gradle.category": "library",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.jvm.version": 8,
        "org.gradle.libraryelements": "jar",
        "org.gradle.usage": "java-runtime"
      },
      "dependencies": [
        {
          "group": "com.squareup.okhttp3",
          "module": "okhttp",
          "version": {
            "requires": "4.7.2"
          }
        },
        {
          "group": "com.squareup.okhttp3",
          "module": "logging-interceptor",
          "version": {
            "requires": "4.7.2"
          }
        },
        {
          "group": "io.github.rburgst",
          "module": "okhttp-digest",
          "version": {
            "requires": "2.5"
          }
        },
        {
          "group": "com.sun.mail",
          "module": "javax.mail",
          "version": {
            "requires": "1.6.2"
          }
        },
        {
          "group": "javax.ws.rs",
          "module": "javax.ws.rs-api",
          "version": {
            "requires": "2.1.1"
          }
        },
        {
          "group": "org.slf4j",
          "module": "slf4j-api",
          "version": {
            "requires": "1.7.30"
          }
        },
        {
          "group": "com.fasterxml.jackson.core",
          "module": "jackson-core",
          "version": {
            "requires": "2.12.4"
          }
        },
        {
          "group": "com.fasterxml.jackson.core",
          "module": "jackson-annotations",
          "version": {
            "requires": "2.12.4"
          }
        },
        {
          "group": "com.fasterxml.jackson.core",
          "module": "jackson-databind",
          "version": {
            "requires": "2.12.4"
          }
        },
        {
          "group": "com.fasterxml.jackson.dataformat",
          "module": "jackson-dataformat-csv",
          "version": {
            "requires": "2.12.4"
          }
        }
      ],
      "files": [
        {
          "name": "marklogic-client-api-5.5-SNAPSHOT.jar",
          "url": "marklogic-client-api-5.5-SNAPSHOT.jar",
          "size": 1641903,
          "sha512": "b8cd84fe0a3d9b96556603abc287190b88a93c7cf53c42f3d8e75b10185d550346f087d3ee46b25ce50a46ddbbaa3f94bb24a9f1f83f1da2d321ec82057c58a9",
          "sha256": "e72ad489ccd3bf13db25a4f9c170d6ce56b0fcdd9f24abaae4c988f514b7ab63",
          "sha1": "2659ae54157fb2fd90d4c7267505ab6042760714",
          "md5": "c622b6f075a0d75250853febf42d4458"
        }
      ]
    }
  ]
}

The above contents were found at marklogic-client-api/build/publications/mainJava/module.json.

Command used to generate module.json file : ./gradlew marklogic-client-api:generateMetadataFileForMainJavaPublication

Hoping to publish and upload metadata in next release.

@thorntonrp , Can you please reply to this comment as far as metadata contents and file location is concerned? Any changes required? Have not worked with Artifactory.

georgeajit avatar May 11 '22 02:05 georgeajit

It just needs to be uploaded to Maven Central to the same folder that has all the other artifact information. For example, for version 5.5.3, it should be found in this folder on Maven Central:

https://repo1.maven.org/maven2/com/marklogic/marklogic-client-api/5.5.3/

The file will be called marklogic-client-api-5.5.3.module.

For an example of another library that publishes Maven metadata, see this one: https://repo1.maven.org/maven2/org/springframework/boot/spring-boot/2.7.0/

When you run gradle publish, it should be automatically publishing the the '*.module' to your private upload repository with everything else. But I'm guessing that whatever process you had for copying those files from your private repository over to Maven Central was skipping that file.

thorntonrp avatar May 24 '22 21:05 thorntonrp

@thorntonrp Thank you for your comments.

Let me talk to the DevOps team that handles Maven Central uploads (for a manual upload). Will look at Jenkins / CI build script to correct this issue from next release.

georgeajit avatar May 24 '22 22:05 georgeajit

This issue has been resolved in Java Client API tagged as 5.5.4.

georgeajit avatar Sep 22 '22 00:09 georgeajit

Thank you. I've verified that this issuer is solved for me by version 5.5.4

thorntonrp avatar Sep 27 '22 15:09 thorntonrp