asciidoctor / asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
https://asciidoctor.github.io/asciidoctor-gradle-plugin/
Apache License 2.0
287 stars 122 forks source link

v4.0.0 compatibility issue with Java 8 #702

Closed abelsromero closed 10 months ago

abelsromero commented 10 months ago

I am unable to bump form 3.3.2 to 4.0.0

- Variant 'runtimeElements' capability org.asciidoctor:asciidoctor-gradle-jvm:4.0.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
    - Incompatible because this component declares a component compatible with Java 11 and the consumer needed a component compatible with Java 8
    - Other compatible attribute:
        - Doesn't say anything about org.gradle.plugin.api-version (required '7.6.2')

More data:

{
  "formatVersion": "1.1",
  "component": {
    "group": "org.asciidoctor",
    "module": "asciidoctor-gradle-jvm",
    "version": "4.0.0",
    "attributes": {
      "org.gradle.status": "release"
    }
  },
  "createdBy": {
    "gradle": {
      "version": "7.0.2"
    }
  },
  "variants": [
    {
      "name": "apiElements",
      "attributes": {
        "org.gradle.category": "library",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.jvm.version": 11,
        "org.gradle.libraryelements": "jar",
        "org.gradle.usage": "java-api"
      },
      "dependencies": [
        {
          "group": "org.ysb33r.gradle",
          "module": "grolifant-herd",
          "version": {
            "requires": "2.2.1"
          }
        },
        {
          "group": "org.asciidoctor",
          "module": "asciidoctor-gradle-base",
          "version": {
            "requires": "4.0.0"
          }
        }
      ],
      "files": [
        {
          "name": "asciidoctor-gradle-jvm-4.0.0.jar",
          "url": "asciidoctor-gradle-jvm-4.0.0.jar",
          "size": 171502,
          "sha512": "c0aa3da94e7d8c4e211c4efebbe07e612bb5696f6571507515d724fd8d2e5212b362b784d1dd2f50f17a476a09fc38bf89b182a6ea6797c1250b54c2c82dd860",
          "sha256": "9e395fe76b629b4e16e4953806a55e516d640c94d4992b746998f9911a4dffcb",
          "sha1": "d7559f3bd9fe8eef8521f0e31d67bf7c77a4bbab",
          "md5": "f9690772be18d488b687e284f4dce51e"
        }
      ]
    },
    {
      "name": "runtimeElements",
      "attributes": {
        "org.gradle.category": "library",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.jvm.version": 11,
        "org.gradle.libraryelements": "jar",
        "org.gradle.usage": "java-runtime"
      },
      "dependencies": [
        {
          "group": "org.ysb33r.gradle",
          "module": "grolifant-rawhide",
          "version": {
            "requires": "2.2.1"
          }
        },
        {
          "group": "org.ysb33r.gradle",
          "module": "grolifant-herd",
          "version": {
            "requires": "2.2.1"
          }
        },
        {
          "group": "org.asciidoctor",
          "module": "asciidoctor-gradle-base",
          "version": {
            "requires": "4.0.0"
          }
        },
        {
          "group": "org.asciidoctor",
          "module": "asciidoctorj-api",
          "version": {
            "requires": "2.5.7"
          }
        }
      ],
      "files": [
        {
          "name": "asciidoctor-gradle-jvm-4.0.0.jar",
          "url": "asciidoctor-gradle-jvm-4.0.0.jar",
          "size": 171502,
          "sha512": "c0aa3da94e7d8c4e211c4efebbe07e612bb5696f6571507515d724fd8d2e5212b362b784d1dd2f50f17a476a09fc38bf89b182a6ea6797c1250b54c2c82dd860",
          "sha256": "9e395fe76b629b4e16e4953806a55e516d640c94d4992b746998f9911a4dffcb",
          "sha1": "d7559f3bd9fe8eef8521f0e31d67bf7c77a4bbab",
          "md5": "f9690772be18d488b687e284f4dce51e"
        }
      ]
    },
    {
      "name": "javadocElements",
      "attributes": {
        "org.gradle.category": "documentation",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.docstype": "javadoc",
        "org.gradle.usage": "java-runtime"
      },
      "files": [
        {
          "name": "asciidoctor-gradle-jvm-4.0.0-javadoc.jar",
          "url": "asciidoctor-gradle-jvm-4.0.0-javadoc.jar",
          "size": 143790,
          "sha512": "7e1831df4ba999b862eeeffc13a797faf9a0fe0d12c5de9d2dca26fc71d8cc07f045909348e069a71618a4a024af31e37fdbd0218fcfc2cf2b329137ca467202",
          "sha256": "ffe0a6d6b157ef4c44e1b1afc450f7ab3ad4422d0c5ebcb89a8af8d179b569db",
          "sha1": "48992e6811001724068f7dcaba6a1be31c205b15",
          "md5": "382d424304917025e19052d02d8b3300"
        }
      ]
    },
    {
      "name": "sourcesElements",
      "attributes": {
        "org.gradle.category": "documentation",
        "org.gradle.dependency.bundling": "external",
        "org.gradle.docstype": "sources",
        "org.gradle.usage": "java-runtime"
      },
      "files": [
        {
          "name": "asciidoctor-gradle-jvm-4.0.0-sources.jar",
          "url": "asciidoctor-gradle-jvm-4.0.0-sources.jar",
          "size": 42674,
          "sha512": "95845ebb152345ff7eb034fe54303c0451de13fc419c4957678fb86709e9674e75d7c67b17222a93875e9811d20c2377739e9e3ef885948661fe2cc05dbf6963",
          "sha256": "426555c974cdf95e00a845cf0721fea23f5619b220804e74d70bc0bb61541f28",
          "sha1": "65c30df944ae43bef8bb0a65968795bf7c65614b",
          "md5": "8248b52dbe61f728bbd108b4499b32c6"
        }
      ]
    }
  ]
}
ysb33r commented 10 months ago

@aalmiray When you did the release, did you use JDK8?

abelsromero commented 10 months ago

I could reproduce that the module is set to the JDK used, at least with publishToMavenLocal. But I am guessing, how is the release done btw?

Luckily, simply adding the toolchain to subprojects { ... } fixes it for me.

  java {
      toolchain {
          languageVersion = JavaLanguageVersion.of(8)
      }
  }

Btw, another thing, I initially got an error running publishToMavenLocal, I had to delete this https://github.com/asciidoctor/asciidoctor-gradle-plugin/blob/d59ca0d667fb914cec12f402f8d9d00249b9b7e6/gradle/publishing.gradle#L117-L121

Invalid publication 'orgasciidoctorjvmepubPluginPluginMarkerMaven': POM file is invalid. Check any modifications you have made to the POM file.

with stacktrace

Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Duplicated tag: 'description' (position: START_TAG seen ...</description>\n  <description>... @10:16) 
        at org.apache.maven.model.io.xpp3.MavenXpp3Reader.checkFieldWithDuplicate(MavenXpp3Reader.java:140)
ysb33r commented 10 months ago

Can you PR that toolchain change, please?

abelsromero commented 10 months ago

The description change removes the description, I need to look into it more carefully. There's a dot being added at some point <description>.</description> 😮

ysb33r commented 10 months ago

The description change removes the description, I need to look into it more carefully. There's a dot being added at some point <description>.</description> 😮

Yes, it is coming from somewhere else. I thought it best to get the update plugin suit out, rather than worry about fixing it at that point in time.

We should anyway rather refactor that pomXml code to be done in buildSrc rather than in publishing.gradle. It should also be easy to make it conditional to only be done when the maven-publish plugin is applied in the build.

abelsromero commented 10 months ago

Thanks for the quick merge.

Yes, it is coming from somewhere else. I thought it best to get the update plugin suit out, rather than worry about fixing it at that point in time.

Not a problem 👍 But then, should we get 4.0.1 asap out and create a separated issue to discuss the "description" ?

ysb33r commented 10 months ago

create a separated issue to discuss the "description"

Yes.

aalmiray commented 10 months ago

@aalmiray When you did the release, did you use JDK8?

No, I used JDK11 as that's my default these days. Sorry, I'll use JDK8 for the patch release.