Login  Register

Re: Using the multi-page converter from maven

Posted by abelsromero on Feb 28, 2021; 11:46pm
URL: https://discuss.asciidoctor.org/Using-the-multi-page-converter-from-maven-tp8549p8550.html

The maven plugin does not use any of your local Ruby installation. It runs it's own "instance" within jRuby and all gems are contained within the different asciidoctor* jars.

If you want to use external gems, you need to use `gemPaths` to point to your Ruby installation path usually under your user directory, but can't confirm extact path in Windows, maybe it's within ruby installation path. BUT I'D RECOMMEND a fully self-contained Maven run that does not deppend on any pre-installation, just check this example https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoc-to-revealjs-example/pom.xml#L24, the steps are these:
1. Addd `mavengem-wagon` maven extension.
2. Add rubygems repository
```
    <repositories>
        <repository>
            <id>mavengems</id>
            <url>mavengem:https://rubygems.org</url>
        </repository>
    </repositories>
```
3. Add `gem-maven-plugin` configuration, same as in example. This will download the gems and place them inside `target`.
4. Add required gems (eg. asciidoctor-multipage ) as a `<groupId>rubygems</groupId>` dependency. Keep the example exclusions because asciidoctor gem is already contained in asciidoctorj jar.
5. Configure gemsPath and requires in the `asciidoctor-maven-plugin`: https://github.com/asciidoctor/asciidoctor-maven-examples/blob/ce3b5b9f97eb3245273d01d4daa86096abc7b45a/asciidoc-to-revealjs-example/pom.xml#L128-L131

Pay attention to match the path in `gem-maven-plugin` and `asciidoctor-maven-plugin`.