简体   繁体   中英

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.

关联验证结果

Is there a dokka integration with the maven release plugin?

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>

Use GradleMavenPush to upload Gradle Android Artifacts, Gradle Java Artifacts and Gradle Kotlin Artifacts to Maven repositories (JCenter, Maven Central, Corporate staging/snapshot servers and local Maven repositories)

apply from: 'https://raw.github.com/Vorlonsoft/GradleMavenPush/master/maven-push.gradle'

You can generate Dokka documentatiton with it, it has task androidDokka(type: Exec, dependsOn: dokkaInitializer) and task coreDokka(type: Exec, dependsOn: dokkaInitializer)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM