sirthias / pegdown

A pure-Java Markdown processor based on a parboiled PEG parser supporting a number of extensions
http://pegdown.org
Apache License 2.0
1.29k stars 218 forks source link

NoClassDefFoundError on jdk8 #242

Closed appraveen closed 7 years ago

appraveen commented 7 years ago

Thank you for the plugin and this would really solve the problem of decorating the javadoc with ease. I am running in to this issue while trying to consume this plugin.

I have a simple maven Project with no dependencies.

Running the below command produces NoClassDefFoundError

javadoc -doclet ch.raffael.doclets.pegdown.PegdownDoclet -docletpath pegdown-doclet-1.3.jar

Stacktrace

java.lang.NoClassDefFoundError: org/parboiled/errors/ParserRuntimeException
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:286)
    at com.sun.tools.javadoc.DocletInvoker.optionLength(DocletInvoker.java:213)
    at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:305)
    at com.sun.tools.javadoc.Start.begin(Start.java:219)
    at com.sun.tools.javadoc.Start.begin(Start.java:205)
    at com.sun.tools.javadoc.Main.execute(Main.java:64)
    at com.sun.tools.javadoc.Main.main(Main.java:54)
Caused by: java.lang.ClassNotFoundException: org.parboiled.errors.ParserRuntimeException

pom file

 <version>1.0-SNAPSHOT</version>
    <dependencies>
       <!-- Originally i did not have any dependenncies besides pegdown jar. These are added based on information provided on other sites/issues-->
        <dependency>
            <groupId>org.parboiled</groupId>
            <artifactId>parboiled-core</artifactId>
            <version>1.1.7</version>
        </dependency>
        <dependency>
            <groupId>org.parboiled</groupId>
            <artifactId>parboiled-java</artifactId>
            <version>1.1.7</version>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-all</artifactId>
            <version>5.0.3</version>
        </dependency>
        <dependency>
            <groupId>ch.raffael.pegdown-doclet</groupId>
            <artifactId>pegdown-doclet</artifactId>
            <version>1.3</version>
        </dependency>
    </dependencies>
<build>
        <plugins>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <doclet>ch.raffael.doclets.pegdown.PegdownDoclet</doclet>
                    <docletArtifact>
                        <groupId>ch.raffael.pegdown-doclet</groupId>
                            <artifactId>pegdown-doclet</artifactId>
                        <version>1.3</version>
                    </docletArtifact>
                    <useStandardDocletOptions>true</useStandardDocletOptions>
                </configuration>
            </plugin>
</plugins>
</build>

Related Issues

https://github.com/sirthias/pegdown/issues/4 https://github.com/sirthias/pegdown/issues/62

Plugin

I installed IntelliJ Plugin, I guess this is only for preview inside IDE. Eventually I get the same error when I run

Tools -> Generate Javadoc -> Command line arguments with "-doclet ch.raffael.doclets.pegdown.PegdownDoclet -docletpath pegdown-doclet-1.3.jar"
Abnaxos commented 7 years ago

When running from the command line, you should use pegdown-doclet-1.3-all.jar. Maven adds the dependent JARs to the doclet path, but when running from the command line, you need to specify them manually. That's why there's a second JAR that already contains all dependencies, to make the command line shorter.

BTW, this is the wrong project. The doclet uses pegdown, but other than that, the two projects are completely unrelated. https://github.com/Abnaxos/pegdown-doclet is the right project.

appraveen commented 7 years ago

Thank you @Abnaxos. '-all' was the issue. Now both javadoc and mvn works

mvn javadoc:javadoc 
dengzun commented 5 years ago

When running from the command line, you should use pegdown-doclet-1.3-all.jar. Maven adds the dependent JARs to the doclet path, but when running from the command line, you need to specify them manually. That's why there's a second JAR that already contains all dependencies, to make the command line shorter.

BTW, this is the wrong project. The doclet uses pegdown, but other than that, the two projects are completely unrelated. https://github.com/Abnaxos/pegdown-doclet is the right project.

Hi Abnaxos, How could I build a new "-all" jar?