Using the multi-page converter from maven

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using the multi-page converter from maven

rockyallen
This works:

asciidoctor -r asciidoctor-multipage -b multipage_html5 -D test test.adoc

But from the same terminal window, this doesn't:

            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>2.1.0</version>
                <configuration>
                    <sourceDirectory>src/asciidoc/userguide</sourceDirectory>
                    <outputDirectory>target</outputDirectory>
                    <sourceDocumentName>master.adoc</sourceDocumentName>
                    <doctype>book</doctype>
                    <attributes>
                        <basedir>${project.basedir}</basedir>
                        <numbered></numbered>
                    </attributes>
                </configuration>   
                <executions>
                    <execution>
                        <id>output-html</id>             
                        <phase>prepare-package</phase> 
                        <goals>
                            <goal>process-asciidoc</goal> 
                        </goals>
                        <configuration>
                           
                            <backend>multipage_html5</backend>
                            <requires>asciidoctor-multipage</requires>
                                                     
                         </configuration>   
                    </execution>
                </executions>           
            </plugin>                       


[ERROR] Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:2.1.0:process-asciidoc (output-html) on project uom-manual: Execution output-html of goal org.asciidoctor:asciidoctor-maven-plugin:2.1.0:process-asciidoc failed: (LoadError) no such file to load -- asciidoctor-multipage -> [Help 1]

Any ideas?
Reply | Threaded
Open this post in threaded view
|

Re: Using the multi-page converter from maven

abelsromero
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`.