Extremely slow KDoc generation in mixed Java/Kotlin maven project

Hello!
I have mixed Java/Kotlin (98% java->2% Kotlin) multimodule maven project.

Originally, we used maven-javadoc-plugin to generate single *-javadoc.jar files per each maven module.

Javadoc maven setup looks like this.
        ........
        <plugins>
        ........
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <phase>test</phase>
                    </execution>
                </executions>
            </plugin>
        ........
        </plugins>
        ........

Average testfull build on my MBP’2015 takes:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:20 min
[INFO] Finished at: 2017-03-12T20:36:05+02:00
[INFO] Final Memory: 86M/978M
[INFO] ------------------------------------------------------------------------

Then, I migrated from maven-javadoc-plugin into dokka-maven-plugin.

Dokka maven setup looks like this.
        ........
        <plugins>
        ........
            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>0.9.13</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <phase>test</phase>
                        <goals>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        ........
        </plugins>
        ........

And testfull build with javadoc/kdoc generation takes:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16:27 min
[INFO] Finished at: 2017-03-12T20:03:19+02:00
[INFO] Final Memory: 209M/1643M
[INFO] ------------------------------------------------------------------------

Nothing wrong with kotlin compilation speed , but the issue with generating javadoc/kdoc’s.

So, the first question: how can I improve javadoc generation speed ? Maybe i have to tune something?

The second question is about generating *-sources.jar artefacts with maven-source-plugin plugin (or any others). Is there a way to generate Jar with sources in mixed java/kotlin projects?

Thanks in advance!

Ok, for my second question, I found answer in StackOwerflow (http://stackoverflow.com/a/42748502/5594325).

Here is my setup for JAR with Java/Kotlin source code generation:

main POM file
......
    <plugins>
    ......
         <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>

                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.basedir}/src/main/kotlin</source>
                                <source>${project.basedir}/src/main/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <attach>true</attach>
                            <forceCreation>true</forceCreation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    ......
    </plugins>
......

I hope, this will help someone :slight_smile:

But the original question about javadoc/kdoc generation speed remains the same…