
Comprehensive template enables building and publishing libraries to Maven Central with ease, offering full multiplatform support, pre-configured development tools, and automated GitHub Actions for seamless release management.
= Kotlin Multiplatform Library Template :toc: left :toclevels: 3 :source-highlighter: highlightjs :icons: font
A comprehensive template for creating Kotlin Multiplatform libraries with publishing to Maven Central.
== Overview
This template provides everything you need to build and publish a Kotlin Multiplatform library to Maven Central. It includes support for multiple platforms and comes pre-configured with modern development tools.
== Supported Platforms
This template supports the following platforms:
[cols="1,2", options="header"] |=== |Platform |Description |JVM |Java Virtual Machine applications, including Compose Desktop |Android |Android applications and libraries |Native |iOS applications |Web |JavaScript & WebAssembly applications |===
== Features
=== Kotlin Multiplatform Full Kotlin Multiplatform setup with support for a variety of targets.
=== Publishing to Maven Central Pre-configured publishing setup using the vanniktech Maven publish plugin with support for:
=== Development Tools
[cols="1,1,2", options="header"] |=== |Tool |Version |Purpose |Kotlinter |Latest |Kotlin linting and code formatting |Dokka |Latest |API documentation generation |Kermit |Latest |Multiplatform logging library |===
=== Project Configuration Centralized configuration using gradle.properties for easy customization:
== Getting Started
=== Prerequisites
=== Setup
Clone this template repository
Update the gradle.properties file with your information:
user, dev, mail, devURL to your detailsrepo, g, artifact, desc for your libraryv
Rename the library module if desired
Start developing your library in the library/src directory
=== Building
To build the library for all platforms:
To run tests on all platforms:
To generate documentation:
== Publishing to Maven Central
This template uses a similar packaging secret method as other Malefic projects, making it easy to set up automated publishing.
For publishing to work, the following GitHub secrets must be configured in your repository:
GPG_KEY_ID: The ID of your GPG keyGPG_PASSPHRASE: The passphrase for your GPG keyGPG_PRIVATE_KEY: Your GPG private keySONATYPE_TOKEN_XML: Your Sonatype Central Portal user token in XML format
======= Setting Up Secrets
==== GPG Key Setup
==== Sonatype Setup
io.github.yourusername)=== Publishing Process
The template includes a GitHub Actions workflow that automatically publishes releases:
To publish manually:
== Project Structure
== Configuration
All project configuration is centralized in gradle.properties:
user=YourGitHubUsername dev=Your Full Name mail=your.email@example.com devURL=https://your-website.com
repo=YourRepositoryName g=your.group.id artifact=your-artifact-name desc=Your library description inception=2025
== Example Usage
The template includes a simple Fibonacci sequence generator as an example. Replace this with your own library code:
// Common code fun generateFibi() = sequence { var a = firstElement yield(a) var b = secondElement yield(b) while (true) { val c = a + b yield(c) a = b b = c } }
expect val firstElement: Int expect val secondElement: Int
== License
This template is licensed under the MIT License. Update the LICENSE file with your chosen license.
== Contributing
== Resources
= Kotlin Multiplatform Library Template :toc: left :toclevels: 3 :source-highlighter: highlightjs :icons: font
A comprehensive template for creating Kotlin Multiplatform libraries with publishing to Maven Central.
== Overview
This template provides everything you need to build and publish a Kotlin Multiplatform library to Maven Central. It includes support for multiple platforms and comes pre-configured with modern development tools.
== Supported Platforms
This template supports the following platforms:
[cols="1,2", options="header"] |=== |Platform |Description |JVM |Java Virtual Machine applications, including Compose Desktop |Android |Android applications and libraries |Native |iOS applications |Web |JavaScript & WebAssembly applications |===
== Features
=== Kotlin Multiplatform Full Kotlin Multiplatform setup with support for a variety of targets.
=== Publishing to Maven Central Pre-configured publishing setup using the vanniktech Maven publish plugin with support for:
=== Development Tools
[cols="1,1,2", options="header"] |=== |Tool |Version |Purpose |Kotlinter |Latest |Kotlin linting and code formatting |Dokka |Latest |API documentation generation |Kermit |Latest |Multiplatform logging library |===
=== Project Configuration Centralized configuration using gradle.properties for easy customization:
== Getting Started
=== Prerequisites
=== Setup
Clone this template repository
Update the gradle.properties file with your information:
user, dev, mail, devURL to your detailsrepo, g, artifact, desc for your libraryv
Rename the library module if desired
Start developing your library in the library/src directory
=== Building
To build the library for all platforms:
To run tests on all platforms:
To generate documentation:
== Publishing to Maven Central
This template uses a similar packaging secret method as other Malefic projects, making it easy to set up automated publishing.
For publishing to work, the following GitHub secrets must be configured in your repository:
GPG_KEY_ID: The ID of your GPG keyGPG_PASSPHRASE: The passphrase for your GPG keyGPG_PRIVATE_KEY: Your GPG private keySONATYPE_TOKEN_XML: Your Sonatype Central Portal user token in XML format
======= Setting Up Secrets
==== GPG Key Setup
==== Sonatype Setup
io.github.yourusername)=== Publishing Process
The template includes a GitHub Actions workflow that automatically publishes releases:
To publish manually:
== Project Structure
== Configuration
All project configuration is centralized in gradle.properties:
user=YourGitHubUsername dev=Your Full Name mail=your.email@example.com devURL=https://your-website.com
repo=YourRepositoryName g=your.group.id artifact=your-artifact-name desc=Your library description inception=2025
== Example Usage
The template includes a simple Fibonacci sequence generator as an example. Replace this with your own library code:
// Common code fun generateFibi() = sequence { var a = firstElement yield(a) var b = secondElement yield(b) while (true) { val c = a + b yield(c) a = b b = c } }
expect val firstElement: Int expect val secondElement: Int
== License
This template is licensed under the MIT License. Update the LICENSE file with your chosen license.
== Contributing
== Resources