A Gradle plugin for publishing and optionally signing JVM-based projects (currently Java/Kotlin) and libraries packages to Maven Central, Gradle Portal, GitHub, GitLab, Artifactory (basic support).
It is working for a lot of cases but under construction there will be compatibility breakage between versions in the 0.x.x series - alpha.
NOTE - NOTE - NOTE: 0.1.16 rewrote a lot of things, so if using an earlier version you need to change properties and tasks, see the following (sparse) docs. Please help by testing and submitting bug-reports. For bug reports it is much more chance that they will be fixed properly if you add examples.
To make life (well, arguably) easier when configuring the plugins needed for these tasks.
To offer a simple, flexible union interface for these tasks, regardless of publishing target.
If you want a coherent configuration for multiple publishing targets this gradle plugin could be for you.
- Maven Central, Gradle Portal, GitLab, GitHub, Artifactory Publishing
- Signing
- Java, Kotlin, Android Library (aar) support (release variant)
- Build file, Properties or System Environment Configuration - or all of them
- Publish to several targets at once
- Configure autorelease to Maven Central
- Dokka Publish support
- Choose to publish with or without source, docs artifacts or with empty source/doc artifacts
- Mice configuration overview and guide for creating templates
- Semi smart configuration :)
- ... and more
-
Add this plugin itself to your plugins block
-
Configure the plugin, see the examples. The examples show the most basic settings - there are lots more to configure or override if you need/want to.
-
Run Gradle Task yappConfiguration to view the plugins current project type and publish target configuration.
-
Run Gradle Task publishArtifactToLocalRepo to publish your task to the local repo for verification.
-
Run Gradle Task publish to publish your plugin.
Besides adding this plugin
plugins {
id("se.svt.oss.gradle-yapp-publisher-plugin") version "x.y.z"
//...
}
You can also add one of the following basic publishing plugins as a placeholder, Publishing Target
Publishing to Maven Central/GitLab/GitHub/Custom (Java/Kotlin Library)
plugins {
`maven-publish`
//...
}
- Publishing to Gradle Portal (Gradle Plugin)*
plugins {
`java-gradle-plugin`
//...
}
The plugin offers a few tasks found under "yapp publisher".
- createConfigurationTemplate TO-DO
- publishArtifact - publish the artifact to the publishing target
- publishArtifactToLocalRepo - publish to local repo
- yappConfiguration - show the current configuration - i.e. type of publishing target, project type and more
A publishing target defines where to publish the project.
Allowed target values are
- artifactory
- maven_central
- maven_central_snapshot
- gitlab
- github
- gradle_portal
- custom TO-DO
If you leave this empty, the plugin will make a guess based on your added plugins and versions.
-
A few properties, depending on your configuration target
-
A project type (for example, a java-library)
-
If project type and publish target are not configured explicitly, they are chosen on a best-effort guess, depending on you chosen plugin and version setup.
Publish to Gradle Portal
With a gradle.properties file and System.ENV
yapp.targets=gradle_portal
yapp.gradleplugin.id=se.svt.oss.gradle-yapp-publisher-plugin
yapp.gradleplugin.description=Yet another plugin that manages publishing for Gradle projects
yapp.gradleplugin.web=https://github.com/svt/gradle-yapp-publisher-plugin
yapp.gradleplugin.vcs=https://github.com/svt/gradle-yapp-publisher-plugin.git
yapp.gradleplugin.tags=maven central, gradle portal, publishing
yapp.gradleplugin.class=YappPublisher
yapp.gradleplugin.displayname=Gradle Yapp Publisher Plugin
GitHub
With a gradle.properties file and System.ENV
yapp.targets= github
yapp.github.actor=<YOUR-GITHUB-USER>
yapp.github.token=<YOUR-GITHUB-PAT> -# put this global gradle.properties, or use system env so you dont commit it
yapp.github.namespace=<YOUR-GITHUB-ORGANISATION/USER>
yapp.github.reponame=<NAME-OF-REPO>
GitLab
With a gradle.properties file and System.ENV
yapp.targets = gitlab
yapp.gitlab.host=https://gitlab.com
yapp.gitlab.token=<YOUR-GITLAB-TOKEN> -# put this global gradle.properties, or use system env so you dont commit it
yapp.gitlab.tokenType=<YOUR-GITLAB-TOKEN-TYPE>
yapp.gitlab.endpointLevel=project
yapp.gitlab.glProjectId=<YOUR-GITLAB-PROJECT-ID>
OSSRH/Maven Central
Build file(build.gradle.kts) configuration, including signing
yapp {
mavenPublishing {
groupId.set("$group")
version.set("$version")
name.set("pn")
description.set("pd")
url.set("http://p.se")
inceptionYear.set("1999")
licenseName.set("pln")
licenseUrl.set("plu")
licenseDistribution.set("pld")
licenseComments.set("plc")
developers.set(listOf(Developer("a","b","c"),Developer("d","e","f")))
organization.set("pdo")
organizationUrl.set("pou")
scmUrl.set("psu")
scmConnection.set("psc")
scmDeveloperConnection.set("psd")
}
signing {
enabled.set(true)
signSnapshot.set(true)
keyId.set("11111111")
password.set("signing")
key.set("signingKey")
}
}
Properties file(gradle.properties) configuration
yapp.targets= maven_central
yapp.mavenPublishing.name = exampleproject
yapp.mavenPublishing.description = an pom example description
yapp.mavenPublishing.url = https://github.com/myexamplaproject
yapp.mavenPublishing.inceptionYear = 2021
yapp.mavenPublishing.scmConnection = scm:git:github.com/example.git
yapp.mavenPublishing.scmDeveloperConnection = scm:git:ssh://github.com/example.git
yapp.mavenPublishing.scmUrl = https://github.com/example
yapp.mavenPublishing.licenseName = The Apache Software License, Version 2.0
yapp.mavenPublishing.licenseUrl = http://www.apache.org/licenses/LICENSE-2.0.txt
yapp.mavenPublishing.developer = an dev id, an dev name, [email protected]
yapp.mavenPublishing.organization = my org name
yapp.mavenPublishing.organizationUrl = my org url
yapp.signing.enabled = false
In an early stage, the following features would be a nice roadmap:
- More tests
- More settings can be simplified and auto set
- Better handling of multi project setup
- More pre-configured targets. Improve the existing ones - JitPack? and Custom Maven Publishing
- Better semi smart Plugin identification
- Create sample configurations
- Support other languages than Java/Kotlin (Groovy,Scala)
- Auto add base plugins based on user publishing target choice
- Why are there tasks called generateMetaDataFileForPluginMavenPublication and more, all relating to "pluginMaven"
It is a design choice (or a bug) from Gradle, these tasks are autogenerated for the Maven Publish plugin and can't be disabled. Look att gradle/gradle#12394
- Why another publisher plugin ?
At the time of starting this plugin there was none found that had all the features this one has. I wanted an easy way to just drop in some configurations and publish to many places. And then it grew.
- Plugin must be applied to the root project but was applied to :subproject when using directReleaseToMavenCentral
This is limitations in the Nexus Gradle Plugin used gradle-nexus/publish-plugin#81 and if using this feature, the project be a root project currently.
- Maven Publish
- Java Gradle Plugin Development Plugin
- Gradle Portal Publishing Plugin
- Gradle Signing Plugin
- Gradle Nexus Publish Plugin
If you have questions, concerns, bug reports, etc, please file an issue in this repository's Issue Tracker.
General instructions for contributing CONTRIBUTING.
The Gradle Yapp Publisher Plugin is released under the:
Josef Andersson https://github.com/janderssonse
Josef Andersson https://github.com/janderssonse Rickard Andersson https://github.com/rickard-svti