asciidoctor / asciidoclet

:clipboard: A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.
https://github.com/asciidoctor/asciidoclet
Apache License 2.0
133 stars 40 forks source link

Missed dependencies in 1.5.6? #95

Closed vitalijr2 closed 1 year ago

vitalijr2 commented 5 years ago

I run building of my project with 1.5.4 and 1.5.6.

When I run building with 1.5.4 it works OK: processes all sources, create plantuml diagram.

When I rum building with 1.5.6 I get error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (attach-javadocs) on project contract: MavenReportException: Error while generating Javadoc: [ERROR] Exit code: 1 - javadoc: error - In doclet class org.asciidoctor.Asciidoclet, method start has thrown an exception java.lang.reflect.InvocationTargetException [ERROR] java.lang.NoClassDefFoundError: org/jruby/exceptions/RaiseException [ERROR] at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:695) [ERROR] at org.asciidoctor.asciidoclet.AsciidoctorRenderer.(AsciidoctorRenderer.java:62) [ERROR] at org.asciidoctor.Asciidoclet.run(Asciidoclet.java:273) [ERROR] at org.asciidoctor.Asciidoclet.start(Asciidoclet.java:268) [ERROR] at org.asciidoctor.Asciidoclet.start(Asciidoclet.java:242) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [ERROR] at java.lang.reflect.Method.invoke(Method.java:498) [ERROR] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:310) [ERROR] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:189) [ERROR] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:366) [ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:219) [ERROR] at com.sun.tools.javadoc.Start.begin(Start.java:205) [ERROR] at com.sun.tools.javadoc.Main.execute(Main.java:64) [ERROR] at com.sun.tools.javadoc.Main.main(Main.java:54) [ERROR] Caused by: java.lang.ClassNotFoundException: org.jruby.exceptions.RaiseException [ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:382) [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424) [ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357) [ERROR] ... 16 more

As far as I understand Asciidoctor could not initialize properly. But I cannot get why as it misses some jruby classes.

Maven: 3.6.0 Java: 1.8.0_202 Asciidoclet: 1.5.6

Maven javadoc plugin's configuration

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>${javadoc-plugin.version}</version>
    <configuration>
        <source>${java.version}</source>
        <overview>src/main/javadoc/overview.adoc</overview>
        <doclet>org.asciidoctor.Asciidoclet</doclet>
        <docletArtifact>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoclet</artifactId>
            <version>${asciidoclet.version}</version>
        </docletArtifact>
        <additionalOptions>
            --base-dir ${project.basedir}/src/main/javadoc
            --attribute "name=${project.name}"
            --attribute "version=${project.version}"
            --attribute "title-link=${project.url}[${project.name} ${project.version}]"
            --require asciidoctor-diagram
            --gem-path ${env.GEM_HOME}
            --attribute data-uri
        </additionalOptions>
        <!--
        <additionalDependencies>
            <additionalDependency>
                <groupId>org.jruby</groupId>
                <artifactId>jruby</artifactId>
                <version>9.2.5.0</version>
            </additionalDependency>
        </additionalDependencies>
        -->
        <!--
        <additionalDependencies>
            <additionalDependency>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctorj-diagram</artifactId>
                <version>1.5.12</version>
            </additionalDependency>
        </additionalDependencies>
        -->
    </configuration>
    <executions>
        <execution>
            <id>attach-javadocs</id>
            <goals>
                <goal>javadoc-no-fork</goal>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

I have tried add jruby and asciidoctor as additional dependencies - it still doesn't work for 1.5.6. Also I have tried both javadoc and javadoc-no-fork goals.

johncarl81 commented 5 years ago

Strange... can you try out 1.5.7-SNAPSHOT?

vitalijr2 commented 5 years ago

can you try out 1.5.7-SNAPSHOT?

OK, I will check.

For both 1.5.4 and 1.5.6 I have cleaned local Maven cache then run building - to check in log which dependencies Maven loads.

For 1.5.4 it loads asciidoctorj/1.5.4, jruby-complete/1.7.21, jruby-artifacts/1.7.21, jruby-parent/1.7.21, jcommander/1.35. For 1.5.6 it loads asciidoctorj/1.5.6, jruby-complete/1.7.26, jruby-artifacts/1.7.26, jruby-parent/1.7.26, jcommander/1.35.

Looks like it is not missing dependency.

johncarl81 commented 5 years ago

I just bumped one of my projects up to 1.5.6 and it built just fine... would you like to try it as well: https://github.com/johncarl81/parceler

asciidoclet is used in the parceler-api and parceler package.

hari87 commented 5 years ago

I think this issue could be related to this one.