A Gradle plugin to easily publish library components to Maven.

Overview

Component Publisher

Maven Central Gradle Plugin Portal License

A Gradle plugin to easily publish components based on maven-publish.

You can find the latest released plugin on Gradle Plugin Portal.

Todo & Progress

  • Publish this plugin onto gradle plugin portal.
  • Improvement of usage doc.
  • Run the publication task with options by project properties.
  • Support signing artifacts before publishing.
  • Import GitHub Actions for automatically publishing.
  • Use TestKit to test functions of Gradle plugin.

Features

  • Publish components easily without any complex configs.
  • Support multi type components. e.g, Java library, Android library, Kotlin lib, Gradle lib etc.
  • Support publishing libraries into local repos, Sonatype release/snapshot repos or Github packages.
  • Safely configure your sensitive credentials in local.properties.

Getting Started

You can quickly publish your own components by following steps with this plugin.

1. Apply plugin

You need apply cn.dorck.component.publisher in build.gradle:

plugins {
  id("cn.dorck.component.publisher") version "1.0.2"
}

2. Configure publish options

You can customize your own publication options like this in your module build.gradle to be released:

publishOptions {
    group = "com.dorck.android"
    version = "0.1.0-LOCAL"
    artifactId = "sample-library"
}

As shown above, you will publish sample-library component into mavenLocal() which stores at /Users/<username>/.m2/repository.

Currently, it supports the following more configuration properties:

Option Description
group The group of maven publication. If empty, use project's group.
artifactId The artifactId of maven publication. If empty, use project's name.
version The version of maven publication. If empty, use project's version.
userName The username of credentials for maven repo.
password The password of credentials for maven repo.
releaseRepoUrl Url for maven release repository.
snapshotRepoUrl Url for maven snapshot repository.
description Library description written in pom file.
packSourceCode Whether to package the source code into jar/aar.
transitiveDependency Will transitive dependencies be required.

If you want to publish component onto remote repositories, you need to specify the userName , password and releaseRepoUrl or snapshotRepoUrl.

3. Execute publication task

Now, you can easily publish your component by gradle command:

$ ./gradlew :<component module name>:publishComponent

Next you will see the following log output from the terminal:

component_output

4. Configure stable options

Normally, our repository urls and credentials information are the same for different components. To prevent repeated configuration, a global default options properties file is supported here. You can just put your global properties in root project local.properties like this:

REPO_USER=Moosphan
REPO_PASSWORD=*****
REPO_RELEASE_URL=https://maven.xx.xx/repository/releases/
REPO_SNAPSHOT_URL=https://maven.xx.xx/repository/snapshots/

Note: If you want to specify repo options for a component, just add repo info in its build.gradle >> publishOptions DSL.

Article Reference

You might also like...
Events Calendar is a user-friendly library that helps you achieve a cool Calendar UI with events mapping. You can customise every pixel of the calendar as per your wish and still achieve in implementing all the functionalities of the native android calendar in addition with adding dots to the calendar which represents the presence of an event on the respective dates. It can be done easily, you are just a few steps away from implementing your own badass looking Calendar for your very own project! This library is a set of simple wrapper classes that are aimed to help you easily access android device information.
This library is a set of simple wrapper classes that are aimed to help you easily access android device information.

SysInfo Simple, single class wrapper to get device information from an android device. This library provides an easy way to access all the device info

A react-like kotlin library to create an inventory ui easily in paper plugins
A react-like kotlin library to create an inventory ui easily in paper plugins

A react-like kotlin library to create an inventory ui easily in paper plugins

Plugin-shared-preferences - Pluto plugin to manage your Shared Preferences

Pluto Shared Preferences Plugin Pluto Shared Preferences is a Pluto plugin to in

DI can be simple. Forget about modules and components. Just use it!

PopKorn - Kotlin Multiplatform DI PopKorn is a simple, powerful and lightweight Kotlin Multiplatform Dependency Injector. It doesn't need any modules

LifecycleMvp 1.2 0.0 Kotlin  is MVP architecture implementation with Android Architecture Components and Kotlin language features
LifecycleMvp 1.2 0.0 Kotlin is MVP architecture implementation with Android Architecture Components and Kotlin language features

MinSDK 14+ Download Gradle Add to project level build.gradle allprojects { repositories { ... maven { url 'https://jitpack.io' }

A fork of our clean architecture boilerplate, this time using the Android Architecture Components

Android Clean Architecture Components Boilerplate Note: This is a fork of our original Clean Architecture Boilerplate, except in this repo we have swi

Built with Jetpack compose, multi modules MVVM clean architecture, coroutines + flow, dependency injection, jetpack navigation and other jetpack components

RickAndMortyCompose - Work in progress A simple app using Jetpack compose, clean architecture, multi modules, coroutines + flows, dependency injection

Kotlin Multiplatform lifecycle-aware business logic components (aka BLoCs) with routing functionality and pluggable UI (Jetpack Compose, SwiftUI, JS React, etc.), inspired by Badoos RIBs fork of the Uber RIBs framework
Kotlin Multiplatform lifecycle-aware business logic components (aka BLoCs) with routing functionality and pluggable UI (Jetpack Compose, SwiftUI, JS React, etc.), inspired by Badoos RIBs fork of the Uber RIBs framework

Decompose Please see the project website for documentation and APIs. Decompose is a Kotlin Multiplatform library for breaking down your code into life

Owner
Hulk Su
Do not listen to the sound of beating leaves through the forest, why not sing and walk slowly.
Hulk Su
A plugin for Termux to use native Android GUI components from CLI applications.

Termux:GUI This is a plugin for Termux that enables command line programs to use the native android GUI. In the examples directory you can find demo v

null 342 Dec 23, 2022
💫 A Gradle Plugin to generate your networking code from Swagger

Swagger Gradle Codegen A Gradle plugin to generate networking code from a Swagger spec file. This plugin wraps swagger-codegen, and exposes a configur

Yelp.com 399 Nov 28, 2022
Gradle plugin adding a task to run a Paper Minecraft server

Run Paper Run Paper is a Gradle plugin which adds a task to automatically download and run a Paper Minecraft server along with your plugin built by Gr

Jason 64 Dec 29, 2022
Gradle plugin for simplify Kotlin Multiplatform mobile configurations

Mobile Multiplatform gradle plugin This is a Gradle plugin for simple setup of Kotlin Multiplatform mobile Gradle modules. Setup buildSrc/build.gradle

IceRock Development 78 Sep 27, 2022
kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin.

kinstall kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin. use First, install kinstall its

david kilmer 0 Apr 24, 2022
The KPy gradle plugin allows you to write Kotlin/Native code and use it from python.

The KPy gradle plugin allows you to write Kotlin/Native code and use it from python.

Martmists 14 Dec 26, 2022
An advanced Minecraft plugin template made in Gradle

//DONT_APPLY_TEMPLATE_CHANGE Gradle Plugin Template Kotlin DSL Version ℹ️ This template was planned to support only kotlin, but it also supports Java!

null 0 Apr 17, 2022
A Gradle plugin for Kotlin Multiplatform projects that generate a XCFramework for Apple targets or a FatFramework for iOS targets, and manages the publishing process in a CocoaPod Repository.

KMP Framework Bundler KMP Framework Bundler is a Gradle plugin for Kotlin Multiplatform projects that generate a XCFramework for Apple targets or a Fa

Marco Gomiero 17 Oct 29, 2022
[Android Library] A SharedPreferences helper library to save and fetch the values easily.

Preference Helper A SharedPreferences helper library to save and fetch the values easily. Featured in Use in your project Add this to your module's bu

Naveen T P 13 Apr 4, 2020
AbstractMvp 0.8 0.0 Kotlin is a library that provides abstract components for MVP architecture realization, with problems solutions that are exist in classic MVP.

MinSDK 14+ AbstractMvp AbstractMvp is a library that provides abstract components for MVP architecture realization, with problems solutions that are e

Robert 12 Apr 5, 2022