Specify version of dependency of Gradle AsciidoctorJ Plugin

43 Views Asked by At

I'm trying to achieve in Gradle 8.1.1 what you would do like this in Maven:

      <plugin>
          <groupId>org.asciidoctor</groupId>
          <artifactId>asciidoctor-maven-plugin</artifactId>
          <version>2.2.4</version>
          <dependencies>
            <dependency>
              <groupId>org.jruby</groupId>
              <artifactId>jruby</artifactId>
              <version>9.4.5.0</version>
            </dependency>

I tried several things. However, I'm at my wits end. Here is my current build.gradle file:

import org.asciidoctor.gradle.jvm.AsciidoctorTask
import org.asciidoctor.gradle.jvm.pdf.AsciidoctorPdfTask


buildscript {
    configurations {
        classpath {
            resolutionStrategy {
                force("org.jruby:jruby-complete:9.4.5.0")
            }
        }
    }
}


plugins {
    id 'maven-publish'
    id 'org.asciidoctor.jvm.convert' version "${asciidoctorVersion}"
    id 'org.asciidoctor.jvm.pdf' version "${asciidoctorVersion}"
}

configurations {

    pluginTool {
        defaultDependencies { dependencies ->
            dependencies.add(this.dependencies.create("org.jruby:jruby-complete:9.4.5.0"))
        }
    }

    implementation {
        withDependencies { DependencySet dependencies ->
            ExternalModuleDependency dep = dependencies.find { it.name == 'jruby-complete' } as ExternalModuleDependency
            dep.version {
                strictly "9.4.5.0"
            }
        }
    }

    userManual {
        canBeConsumed = true
        canBeResolved = false
    }
}

asciidoctorj {
    fatalWarnings missingIncludes()

    version '2.5.10'

    modules {
        diagram.use()
        diagram.version '2.2.13'
        pdf.version '2.3.9'
    }

    attributes = [
            'build-gradle': file('build.gradle'),
            'author'      : 'abc',
            'revnumber'   : project.version,
    ]
}

I want the plugin to use a newer jruby-version in order to fix this bug here: https://github.com/asciidoctor/asciidoctor-maven-plugin/issues/553

Similar stuff has been discussed here: Force version of dependency in gradle plugin

Have no clue how to verify which dependency is actually used. The bug, however is still there and several versions of jruby are in my dependency-verification.xml.

0

There are 0 best solutions below