GitHub: gradle-publish-plugin
Gradle Publish Plugin
A flex gradle plugin for publish your library to maven repository become easy.
Feature
- Support publish multi-library, such as Java, Android, Kotlin
- support for api / implementation dependencies in new Gradle
- supports also @aar and transitive: false.
- generate Kotlin doc with dokka
- support upload sources Jar (configurable, default true)
- sign a library including sources, Javadoc, and a customized POM (configurable, default false, and require Gradle Version >= 4.8)
Usage
For Gradle version >= 2.1:
Plugins {id "com.whl.gradle-publish-plugin" version "0.1.16-snapshot"} plugins {id "com.whl.gradle-publish-plugin" version "0.1.16-snapshot"}Copy the code
For Gradle version < 2.1 or where dynamic configuration is required:
buildscript { repositories { maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "Com.whl :gradle-publish-plugin: 0.1.16-snapshot"}} Apply plugin: "com.whl:gradle-publish-plugin: 0.1.16-snapshot "}} Apply plugin: "com.whl:gradle-publish-plugin: 0.1.16-snapshot "}} Apply plugin: "com.whl:gradle-publish-plugin: 0.1.16-snapshot"Copy the code
Also see it in Gradle plugins
“com.whl.gradle-publish-plugin” should be after apply “java-library” or “com.android.library”
Then, configuration in your build. Gradle, such as:
simple example:
Group 'com.example' version '1.0-SNAPSHOT' gradlePublish {releaseRepository {url = "http://your repository.com/nexus/content/repositories/releases" userName = "your release account" password = "your release account" }}Copy the code
complete example:
Group 'com.example' version '1.0-SNAPSHOT' gradlePublish {sourceJarEnabled = true javaDocEnabled = true signEnabled = false releaseRepository { url = "http://your repository.com/nexus/content/repositories/releases" userName = "your release account" password = "your release account" } snapshotRepository { url = "http://your repository.com/nexus/content/repositories/snapshots" userName = "your snapshot account" password = "your snapshot account" } }Copy the code
last, execute ./gradlew publish
task to publish your library to specified maven repository