Last active
January 28, 2017 16:39
-
-
Save oluwasayo/316ce296ede71500aeb57dd2c783ca13 to your computer and use it in GitHub Desktop.
Publishing 100% Kotlin Projects to Maven Central
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Javadoc is a prerequisite for Maven Central sync. | |
Kotlin projects use KDoc and do not generate Javadoc by default. | |
An official tool called Dokka can be used to generate Javadoc from Kotlin projects. https://github.com/Kotlin/dokka | |
Putting it all together in Maven: | |
Add the JCenter repository where Dokka is hosted. | |
``` | |
<pluginRepositories> | |
<pluginRepository> | |
<id>jcenter</id> | |
<name>JCenter</name> | |
<url>https://jcenter.bintray.com/</url> | |
</pluginRepository> | |
</pluginRepositories> | |
``` | |
Add the Dokka plugin. | |
``` | |
<plugins> | |
<!-- Other plugins specified here --> | |
<plugin> | |
<groupId>org.jetbrains.dokka</groupId> | |
<artifactId>dokka-maven-plugin</artifactId> | |
<version>0.9.13</version> | |
<executions> | |
<execution> | |
<phase>pre-site</phase> | |
<goals> | |
<goal>javadocJar</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
``` | |
Modify the release plugin declaration to invoke Dokka before commit. | |
``` | |
<pluginManagement> | |
<plugins> | |
<!-- Other plugins specified here --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-release-plugin</artifactId> | |
<version>2.5.3</version> | |
<configuration> | |
<goals>dokka:javadocJar deploy</goals> | |
</configuration> | |
</plugin> | |
</plugins> | |
</pluginManagement> | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment