Problems running dokka-cli-1.4.0-rc.jar from the command line

@BarkingBad Here is the result with your suggested input (using version 1.4.10):

> "C:\opt\jdk-1.8.0_262-b10\bin\java.exe"  -jar "%LOCALAPPDATA%\Temp\lib\dokka-cli-1.4.10.jar" -pluginsClasspath "%USERPROFILE%\.m2\repository\org\jetbrains\kotlinx\kotlinx-coroutines-core\1.3.9\kotlinx-coroutines-core-1.3.9.jar;%LOCALAPPDATA%\Temp\lib\kotlinx-cli-jvm-0.3.jar;%LOCALAPPDATA%\Temp\lib\kotlinx-html-jvm-0.7.2.jar;%LOCALAPPDATA%\Temp\lib\kotlin-analysis-compiler-1.4.10.jar;%LOCALAPPDATA%\Temp\lib\dokka-analysis-1.4.10.jar;%LOCALAPPDATA%\Temp\lib\dokka-base-1.4.10.jar;%LOCALAPPDATA%\Temp\lib\dokka-core-1.4.10.jar;" -outputDir "K:\examples\Reflection\target\docs" -sourceSet "-moduleName Reflection -moduleVersion 0.1-SNAPSHOT -src K:\examples\Reflection\src\main\kotlin"
Exception in thread "main" java.lang.IllegalStateException: Value for argument moduleName isn't set. ArgParser.parse(...) method should be called before.
        at kotlinx.cli.ArgumentSingleValue.getValue(ArgumentValues.kt:121)
        at kotlinx.cli.CLIEntity.getValue(Arguments.kt:49)
        at org.jetbrains.dokka.ArgTypeArgument.convert(main.kt:287)
        at org.jetbrains.dokka.ArgTypeArgument.convert(main.kt:284)
        at kotlinx.cli.ArgumentMultipleValues.saveValue(ArgumentValues.kt:163)
        at kotlinx.cli.ParsingValue.addValue$kotlinx_cli(ArgumentValues.kt:69)
        at kotlinx.cli.ArgParser.saveAsOption(ArgParser.kt:341)
        at kotlinx.cli.ArgParser.parse(ArgParser.kt:469)
        at kotlinx.cli.ArgParser.parse(ArgParser.kt:375)
        at org.jetbrains.dokka.GlobalArguments.<init>(main.kt:90)
        at org.jetbrains.dokka.MainKt.main(main.kt:336)

Any idea what’s wrong with moduleName argument ?

The API has slightly changed between 1.4.0-rc and 1.4.10. Now, the moduleName argument is per configuration (not sourceSet, as it was leftover of dokka 0.10.0, which didn’t make sense anymore). I guess it’s a bug that it has no default value. Nonetheless, you should move -moduleName <your_name_here> from -sourceSet to just top-level argument in a new version

1 Like

Thanks for the fast feedback.

Following your suggestion I moved both arguments -moduleName and -moduleVersion (must also be moved) to the top-level. I now get the following assertion error:

> "C:\opt\jdk-1.8.0_262-b10\bin\java.exe"  -jar "%LOCALAPPDATA%\Temp\lib\dokka-cli-1.4.10.jar" -pluginsClasspath "%USERPROFILE%\.m2\repository\org\jetbrains\kotlinx\kotlinx-coroutines-core\1.3.9\kotlinx-coroutines-core-1.3.9.jar;%LOCALAPPDATA%\Temp\lib\kotlinx-cli-jvm-0.3.jar;%LOCALAPPDATA%\Temp\lib\kotlinx-html-jvm-0.7.2.jar;%LOCALAPPDATA%\Temp\lib\kotlin-analysis-compiler-1.4.10.jar;%LOCALAPPDATA%\Temp\lib\dokka-analysis-1.4.10.jar;%LOCALAPPDATA%\Temp\lib\dokka-base-1.4.10.jar;%LOCALAPPDATA%\Temp\lib\dokka-core-1.4.10.jar;" -moduleName Reflection -moduleVersion 0.1-SNAPSHOT -outputDir "K:\examples\Reflection\target\docs" -sourceSet "-src K:\examples\Reflection\src\main\kotlin"
WARN: Dokka 1.4.* is an alpha project
PROGRESS: Initializing plugins
PROGRESS:
Exception in thread "main" java.lang.AssertionError: Dokka API found on plugins classpath. This will lead to subtle bugs. Please fix your plugins dependencies or exclude dokka api artifact from plugin classpath
        at org.jetbrains.dokka.plugability.DokkaContextKt.checkClasspath(DokkaContext.kt:216)
        at org.jetbrains.dokka.plugability.DokkaContextKt.access$checkClasspath(DokkaContext.kt:1)
        at org.jetbrains.dokka.plugability.DokkaContext$Companion.create(DokkaContext.kt:36)
        at org.jetbrains.dokka.DokkaGenerator.initializePlugins(DokkaGenerator.kt:72)
        at org.jetbrains.dokka.DokkaGenerator.initializePlugins$default(DokkaGenerator.kt:71)
        at org.jetbrains.dokka.DokkaGenerator$generate$1.invoke(DokkaGenerator.kt:27)
        at org.jetbrains.dokka.DokkaGenerator$generate$1.invoke(DokkaGenerator.kt:19)
        at org.jetbrains.dokka.DokkaGeneratorKt.timed(DokkaGenerator.kt:165)
        at org.jetbrains.dokka.DokkaGeneratorKt.access$timed(DokkaGenerator.kt:1)
        at org.jetbrains.dokka.DokkaGenerator.generate(DokkaGenerator.kt:23)
        at org.jetbrains.dokka.MainKt.main(main.kt:343)
Error: Generation of HTML documentation failed

Any idea which file path is superfluous/erronous in -pluginsClasspath ?

PS. More readable paths:

-jar
   dokka-cli-1.4.10.jar

-pluginsClasspath
   kotlinx-coroutines-core-1.3.9.jar
   kotlinx-cli-jvm-0.3.jar
   kotlinx-html-jvm-0.7.2.jar
   kotlin-analysis-compiler-1.4.10.jar
   dokka-analysis-1.4.10.jar
   dokka-base-1.4.10.jar
   dokka-core-1.4.10.jar

I believe it’s because of dokka-core. It should not be on plugins’ classpath. If it doesn’t fix the build, please file an issue at github Kotlin/dokka repository.

I renew this request. This thread should be sufficient evidence for the need.

1 Like

You’re right; I did not follow your instructions properly (see your post from Aug 21).

I confirm providing the 6 dependencies in -pluginsClasspath are ok:

dokka-analysis-1.4.10.jar
dokka-base-1.4.10.jar
kotlin-analysis-compiler-1.4.10.jar
kotlin-analysis-intellij-1.4.10.jar
kotlinx-coroutines-core-1.3.9.jar
kotlinx-html-jvm-0.7.2.jar

The output now looks as follows:

WARN: Dokka 1.4.* is an alpha project
PROGRESS: Initializing plugins
Loaded plugins: [org.jetbrains.dokka.base.DokkaBase]
Loaded: [
        ExtensionPoint: org.jetbrains.dokka.CoreExtensions/allModulePageCreator,
        ExtensionPoint: org.jetbrains.dokka.CoreExtensions/pageTransformer,
        [ ... (removed) ... ]
        Extension: org.jetbrains.dokka.base.DokkaBase/psiToDocumentableTranslator,
        Extension: org.jetbrains.dokka.base.DokkaBase/descriptorToDocumentableTranslator
]
Suppressed: [

]
PROGRESS: Creating documentation models
PROGRESS: Transforming documentation model before merging
PROGRESS: Merging documentation models
PROGRESS: Transforming documentation model after merging
PROGRESS: Creating pages
PROGRESS: Transforming pages
PROGRESS: Rendering
Unused extension points found: ExtensionPoint: org.jetbrains.dokka.CoreExtensions/allModulePageCreator
Generation completed with 1 warning and 0 errors
PROGRESS:


 === TIME MEASUREMENT ===

                           Initializing plugins:  571
                  Creating documentation models: 2326
Transforming documentation model before merging:    0
                   Merging documentation models:    0
 Transforming documentation model after merging:   63
                                 Creating pages:   53
                             Transforming pages:   47
                                      Rendering: 2036

PS. I still need to figure out why -language-features (directory with root file index.html) and -search.html start with a ‘-’ character (maybe more arguments are required):

> dir /b target\docs
-language-features
-search.html
images
navigation.html
scripts
styles

Hello,

I’m having similar problems when trying to run dokka on the CLI.

To simplify my experiments, I put all the jars in the root folder of the project that shall be documented.

Here is the command I’ve tried, based on posts above:

C:\Users\myuser\Downloads\my-project-master\my-project-master>java -jar dokka-cli-1.4.20.jar -pluginsClasspath “dokka-base-1.4.20.jar;dokka-analysis-1.4.20.jar;kotlin-analysis-compiler-1.4.20.jar;kotlin-analysis-intellij-1.4.20.jar;kotlinx-coroutines-core-1.3.9.jar” -moduleName CODEZ -sourceSet “-src c:\users\myuser\downloads\my-project-master\my-project-master\src”

The output ( I have ommited hte loading of modules because its a long list - please let me know if it is relevant ):

WARN: Dokka 1.4.* is an alpha project
PROGRESS: Initializing plugins
Loaded plugins: [org.jetbrains.dokka.base.DokkaBase]
Loaded: [
ExtensionPoint: org.jetbrains.dokka.CoreExtensions/allModulePageCreator,

    ...

]
Suppressed: [

]
PROGRESS: Validity check
PROGRESS: Creating documentation models
WARN: The registry key ‘java.correct.class.type.by.place.resolve.scope’ accessed, but not loaded yet
PROGRESS: Transforming documentation model before merging
PROGRESS: Merging documentation models
PROGRESS: Transforming documentation model after merging
PROGRESS: Creating pages
PROGRESS: Transforming pages
WARN: For Main: expected 1 page, but got 2
WARN: For Main: expected 1 page, but got 17
WARN: For TestTeacherHiddenProject: expected 1 page, but got 5
WARN: For TestTeacherProject: expected 1 page, but got 5
WARN: For TestStudent: expected 1 page, but got 3
PROGRESS: Rendering
ERROR: Failed to write org.jetbrains.dokka.base.renderers.FileWriter@71f06339. Parent job is Cancelling
kotlinx.coroutines.JobCancellationException: Parent job is Cancelling; job=ScopeCoroutine{Cancelling}@7b080849
Caused by: java.lang.NoClassDefFoundError: kotlinx/html/stream/StreamKt
at org.jetbrains.dokka.base.renderers.html.HtmlRenderer.buildHtml(HtmlRenderer.kt:717)

Any ideas?

Thanks in advance.

Hey,
it seems you are missing kotlinx-html-jvm-0.7.2.jar on your classpath. Let me know if this fixes NoClassDefFoundError. For the overflow of pages and in result failing job with coroutines I believe there is something wrong with you configuration, could you send the repository hosted online on e. g. github to see the sourcecode? I have not been in this project for past 3 months, so if there are any further concerns, I will delegate this issue to my colleagues.

I have a related question about generating documentation for a muli-module project. Since -moduleName is a top-level argument, it appears that I can generate dokka files for only one module at a time. Is this correct? With javadoc I get an initial index.html page showing all modules – see below showing three modules. I can create such a page by hand if necessary for dokka, but it would be nice if a similar overview page were created automatically.

Currently dokka doesn’t support javadoc multimodule projects, here is an issue if you are interested in tracking this feature.

Technically if you really need it you can run dokka on all modules separately and handcraft the main page to list all of them but you wont get any linking between the contents of those modules. It might be a better idea to submit a contribution to dokka, since people would be able to use it, if you have some spare time of course