Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoClassDefFoundError when using command line #38

Closed
jmbruel opened this issue Nov 22, 2014 · 12 comments
Closed

java.lang.NoClassDefFoundError when using command line #38

jmbruel opened this issue Nov 22, 2014 · 12 comments

Comments

@jmbruel
Copy link

jmbruel commented Nov 22, 2014

I am trying to use asciidoclet in command line:

javadoc ... -doclet org.asciidoctor.Asciidoclet -docletpath doclet/asciidoclet-1.5.0.jar ...

And I get:
javadoc: error - In doclet class org.asciidoctor.Asciidoclet, method optionLength has thrown an exception java.lang.reflect.InvocationTargetException
java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableList

Any idea? Thanks in advance

@johncarl81
Copy link
Member

You're probably not pulling in all the dependencies of Asciidoclet (which there are quite a few). Any reason why you aren't using a CLI build tool?

@jmbruel
Copy link
Author

jmbruel commented Nov 26, 2014

Guess I'll have to ;-)
No reason other than the fact that this is for a course (B.Sc. kind of level) and they are only using
scripting techniques so far.

@johncarl81
Copy link
Member

This is a really good point though, we could shade the dependencies of Asciidoclet to make it a single unified jar to avoid problems like this.

@jmbruel
Copy link
Author

jmbruel commented Nov 27, 2014

I raised the point because I had no problem with the plantuml doclet (also a jar file).
http://plantuml.sourceforge.net/doclet.html

@johncarl81
Copy link
Member

I was tinkering around with the shade plugin, if you'd like to try the single-jar result here's a link:
https://oss.sonatype.org/content/repositories/snapshots/org/asciidoctor/asciidoclet/1.5.2-SNAPSHOT/asciidoclet-1.5.2-20141128.154014-1.jar
^ Wow, 51 megabytes

@jmbruel
Copy link
Author

jmbruel commented Nov 30, 2014

This works great in command-line! Thanks a lot. Should make it available :-)
Great job.

@jmbruel jmbruel closed this as completed Nov 30, 2014
@johncarl81
Copy link
Member

@benevans, @mojavelinux what are your thoughts on combining the artifact and dependencies into one jar? Personally, I was surprised by the size of the result but I wonder if there's something we can do to reduce this.

@johncarl81 johncarl81 reopened this Nov 30, 2014
@mojavelinux
Copy link
Member

@johncarl81 The shaded jar is huge because of a packaging bug introduced in AsciidoctorJ 1.5.0 (and present in 1.5.1). AsciidoctorJ 1.5.2 will be 650K (which doesn't include JRuby). If we can figure out what to take from JRuby specifically, then we might be able to get the contribution from JRuby down.

Another approach here is to create a distribution, which we'll be doing with AsciidoctorJ 1.5.2.

(We've switched to Gradle for the build, which makes creating a distribution jar super simple. It even provides a launcher script).

@johncarl81
Copy link
Member

I guess we'll wait for 1.5.2 for this then.

@mojavelinux
Copy link
Member

That's what I recommend. We should have it out by this weekend.

@mojavelinux
Copy link
Member

1.5.2 is out!

Btw, what we're talking about here is both a distribution and a fat jar. A distribution is just putting everything in one zip with a launcher script to run the java command with everything on the classpath (Gradle provides this out of the box). A fat jar is when you stuff everything into a single jar. The convention for naming a fat jar is *-all.jar or *-complete.jar.

@johncarl81
Copy link
Member

This should be available in the upcoming 1.5.3 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants