All Projects → johnsonlee → sonatype-publish-plugin

johnsonlee / sonatype-publish-plugin

Licence: Apache-2.0 License
Gradle Plugin for publishing artifacts to Sonatype and Nexus

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to sonatype-publish-plugin

Gradle Maven Publish Plugin
Gradle plugin that configures an uploadArchives task to automatically upload all of your Java, Kotlin or Android libraries to any Maven instance.
Stars: ✭ 392 (+2205.88%)
Mutual labels:  gradle, maven, publishing
Gradle Nexus Plugin
Gradle plugin for configuring and uploading artifacts to Sonatype Nexus
Stars: ✭ 284 (+1570.59%)
Mutual labels:  maven, gradle-plugin, publish
Jitpack.io
Documentation and issues of https://jitpack.io
Stars: ✭ 2,156 (+12582.35%)
Mutual labels:  gradle, maven, publish
Javapackager
📦 Gradle/Maven plugin to package Java applications as native Windows, Mac OS X, or GNU/Linux executables and create installers for them.
Stars: ✭ 285 (+1576.47%)
Mutual labels:  gradle, maven, gradle-plugin
Bintray Publish
Super easy way to publish your Android and Java artifacts to bintray.
Stars: ✭ 97 (+470.59%)
Mutual labels:  gradle, publishing, publish
Jib
🏗 Build container images for your Java applications.
Stars: ✭ 11,370 (+66782.35%)
Mutual labels:  gradle, maven, gradle-plugin
Maven Git Versioning Extension
This extension will virtually set project versions, based on current git branch or tag.
Stars: ✭ 178 (+947.06%)
Mutual labels:  gradle, maven, gradle-plugin
kobby
Kobby is a codegen plugin of Kotlin DSL Client by GraphQL schema. The generated DSL supports execution of complex GraphQL queries, mutation and subscriptions in Kotlin with syntax similar to native GraphQL syntax.
Stars: ✭ 52 (+205.88%)
Mutual labels:  maven, gradle-plugin
vacomall
☀️☀️ 基于 dubbo 实现的分布式电商平台。
Stars: ✭ 42 (+147.06%)
Mutual labels:  maven, nexus
gradle-git-versioning-plugin
This extension will set project version, based on current Git branch or tag.
Stars: ✭ 44 (+158.82%)
Mutual labels:  maven, gradle-plugin
Github-Release-Action
Publish Github releases in an action
Stars: ✭ 100 (+488.24%)
Mutual labels:  publishing, publish
RapidMavenPushPlugin
A Gradle plugin : Upload Artifacts to Multi Maven Repository
Stars: ✭ 21 (+23.53%)
Mutual labels:  maven, gradle-plugin
terraform-provider-nexus
Terraform provider for Sonatype Nexus
Stars: ✭ 74 (+335.29%)
Mutual labels:  nexus, sonatype
gatling-gradle-plugin-demo
Showcase of the Gatling Plugin for Gradle
Stars: ✭ 17 (+0%)
Mutual labels:  gradle, gradle-plugin
maven-artifacts-uploader
command line tool for uploading directory of maven artifacts to nexus 3.x repository
Stars: ✭ 30 (+76.47%)
Mutual labels:  maven, nexus
native-build-tools
Native-image plugins for various build tools
Stars: ✭ 168 (+888.24%)
Mutual labels:  maven, gradle-plugin
wisdom
🎁 Tool for publishing releases to github and npm
Stars: ✭ 16 (-5.88%)
Mutual labels:  publishing, publish
jcenter-config
Painlessly publish your library/project to jcenter() with these simple scripts.
Stars: ✭ 13 (-23.53%)
Mutual labels:  maven, publish
apple-news
A Node.js client for interacting with the Apple News API 📰
Stars: ✭ 34 (+100%)
Mutual labels:  publishing, publish
gradle-helm-plugin
A Gradle plugin for building, publishing and managing Helm charts.
Stars: ✭ 42 (+147.06%)
Mutual labels:  gradle, gradle-plugin

Introduction

Due to Sonatype's strict validation rules, the publishing requirement must be satisfied by every artifact which wants to be published to Sonatype.

For Java and Android library projects, the publishing configurations are very similar, but the configurations of creating publication are quite different, this gradle plugin is used to simplify the engineering complexity of publishing artifacts to Sonatype, developers don't need to write boilerplate publishing DSL for each project to satisfy Sonatype validation rules.

This plugin not only support publishing artifacts to Sonatype, but also support publishing artifacts to private Nexus repository.

Prerequisite

For more information, see References

Getting Started

Apply plugin

Plugins DSL

plugins {
    id("io.johnsonlee.sonatype-publish-plugin") version "1.3.0"
}

group = "..."
version = "..."

Legacy DSL

buildscript {
    repositories {
        mavenCentral()
        google()
        gradlePluginPortal()
    }
    dependencies {
        classpath("io.johnsonlee:sonatype-publish-plugin:1.3.0")
    }
}

apply plugin: "io.johnsonlee.sonatype-publish-plugin"

group = "..."
version = "..."

Configure env and properties

Sonatype

  • OSSRH_USERNAME

    The account id of Sonatype, searching from project properties by default, otherwise searching from system env

  • OSSRH_PASSWORD

    the account password of Sonatype, searching from project properties by default, otherwise searching from system env

  • OSSRH_PACKAGE_GROUP

    The package group of Sonatype, e.g. io.johnsonlee, searching from project properties by default, otherwise searching from system env

Nexus

  • NEXUS_URL

    The endpoint of Nexus service, e.g. http://nexus.johnsonlee.io/, searching from project properties by default, otherwise searching from system env

  • NEXUS_USERNAME

    The account id of Nexus, searching from project properties by default, otherwise searching from system env

  • NEXUS_PASSWORD

    The account password of Nexus, searching from project properties by default, otherwise searching from system env

Signing

  • signing.keyId

    The GPG key id (short format). In this example, the GPG key id is 71567BD2

    $ gpg --list-secret-keys --keyid-format=short
    /Users/johnsonlee/.gnupg/secring.gpg
    ------------------------------------
    sec   4096R/71567BD2 2021-03-10 [expires: 2031-03-10]
    uid                  Johnson
    ssb   4096R/4BA89E7A 2021-03-10
    
  • signing.password

    The password of GPG key

  • signing.secretKeyRingFile

    The secret key ring file, e.g. /Users/johnsonlee/.gnupg/secring.gpg

    The best practice is putting the properties above into ~/.gradle/gradle.properties

    OSSRH_USERNAME=johnsonlee
    OSSRH_PASSWORD=*********
    OSSRH_PACKAGE_GROUP=io.johnsonlee
    signing.keyId=71567BD2
    signing.password=*********
    signing.secretKeyRingFile=/Users/johnsonlee/.gnupg/secring.gpg

Configure Git Repository

The following git configurations are be used for generating maven POM file, please skip if already done.

  • user.name

    git config user.name <username>
  • user.email

    git config user.email <email-address>
  • remote.origin.url (optional)

    The remote.origin.url is available by default unless the git repository is created locally

    git remote add origin [email protected]:<username>/<repository>

Configure Project Info

  • project.group

    The groupId of the publication, only the root project need to configured, subproejcts will inherit from the root project

  • project.version

    The version of the publication, only the root project need to configured, subproejcts will inherit from the root project

The artifactId of the publication is the project.name by default

Configure License (optional)

Add a license file (LICENSE, LICENSE.txt, LICENSE.md or LICENSE.rst) into project, then the license type will be recognized automatically.

For more information on repository licenses, see "Supported Licenses"

Publish Artifacts to Sonatype

./gradlew clean publishToSonatype
./gradlew closeAndReleaseRepository

Publish Artifacts to Nexus

Java/Kotlin Project

./gradlew clean publish

Android Project

For Android projects, using -x to disable publication tasks for debug variants:

./gradlew clean publish -x publishDebug

After release complete, the artifacts will be synced to Maven Central automatically

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].