Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate javadoc jar for repository upload with dokka?

I have recently migrated a java component to kotlin. So far when I used the maven release plugin, it automatically generated the javadoc too and it was also uploaded to oss.sonatype.com. Dokka at the other hand does not seem to be integrated with the release plugin out-of-the-box. As a result, after upload to oss.sonatype.com, nexus rejects release with validation error, because the javadoc jar is missing.

nexus validation results

Is there a dokka integration with the maven release plugin?

like image 679
kocka Avatar asked Oct 19 '25 05:10

kocka


1 Answers

Found the problem. Dokka does have the required maven goal (dokka:javadocJar) but unlike with maven-javadoc-plugin, it is not bound to the packaging lifecycle. The easy fix is

                <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>${dokka.version}</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>dokka</goal>
                            <goal>javadoc</goal>
                            <goal>javadocJar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <file>packages.md</file>
                    </includes>
                </configuration>
            </plugin>
like image 152
kocka Avatar answered Oct 21 '25 23:10

kocka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!