Helper to upload Gradle Android Artifacts, Gradle Java Artifacts and Gradle Kotlin Artifacts to Maven repositories (JCenter, Maven Central, Corporate staging/snapshot servers and local Maven repositories).

Overview

GradleMavenPush Android Arsenal Latest Version

Helper to upload Gradle Android Artifacts, Gradle Java Artifacts and Gradle Kotlin Artifacts to Maven repositories (JCenter, Maven Central, Corporate staging/snapshot servers and local Maven repositories).

Contents

Usage

1. Have a working Gradle build

It is up to you.

2. Update your home gradle.properties

This will include flag IS_JCENTER (default is "false" - Maven Central, "true" - JCenter), username and password (API Key for JCenter) to upload to the Maven server and so that they are kept local on your machine. The location defaults to USER_HOME/.gradle/gradle.properties.

It may also include your signing key id, password, and secret key ring file (for signed uploads). Signing is only necessary if you're putting release builds of your project on Maven Central or JCenter.

IS_JCENTER                = false
NEXUS_USERNAME            = vorlonsoft
NEXUS_PASSWORD            = $tr0ngP@55w0rd

signing.keyId             = ABCDEF12
signing.password          = P@55w0rd
signing.secretKeyRingFile = ./secring.gpg

2.1. Alternative, use environment variables (optional)

You can modify username and password (API Key for JCenter) from environment variables (useful for CI). To use those environment variables on CI just export them:

export NEXUS_USERNAME      = vorlonsoft
export NEXUS_PASSWORD      = $tr0ngP@55w0rd

2.2. Other home gradle.properties (optional)

This will include JCENTER_USERNAME (default is NEXUS_USERNAME value) and JCENTER_API_KEY (default is NEXUS_PASSWORD value) to upload to the JCentor. Also you can modify JCENTER_USERNAME and JCENTER_API_KEY from environment variables (useful for CI).

JCENTER_USERNAME          = vorlonsoft
JCENTER_API_KEY           = $tr0ngJCenter@P!Key

3. Create project root gradle.properties

You may already have this file, in which case just edit the original. This file should contain the properties values which are common to all of your sub-projects (if you have any). For instance, here's AndroidRate's:

# GROUP (default is packageName for Android projects, "" for non-Android)
GROUP                  = com.vorlonsoft
# VERSION_NAME (default is build.gradle versionName for Android projects, "" for non-Android)
VERSION_NAME           = 1.2.0-SNAPSHOT

POM_DESCRIPTION        = Library for Android applications, which provides rating dialog.
POM_URL                = https\://github.com/Vorlonsoft/AndroidRate
POM_LICENCE_NAME       = The MIT License (MIT)
POM_LICENCE_URL        = https\://opensource.org/licenses/MIT
POM_DEVELOPER_ID       = AlexanderLS
POM_DEVELOPER_NAME     = Alexander Savin
POM_DEVELOPER_EMAIL    = [email protected]
POM_SCM_CONNECTION     = scm\:[email protected]\:Vorlonsoft/AndroidRate.git

The VERSION_NAME value is important. If it contains the keyword SNAPSHOT then the build will upload to the snapshot server, if not then to the release server.

3.1. Modify the version name from environment variable (optional)

If there's an environment variable called VERSION_NAME_EXTRAS, its value will get appended at the end of VERSION_NAME. This can be very powerful when running from CI. For example, to have one SNAPSHOT per branch, you could

export VERSION_NAME_EXTRAS = -master-SNAPSHOT

in this case it will be uploaded to the snapshot server and indicates it's from the master branch.

4. Create gradle.properties in each module

The values in this file are specific to the sub-project (and override those in the root gradle.properties). In this example, this is just the name, artifactId and JAVADOC_BY_DOKKA (default is "false"):

POM_ARTIFACT_ID  = androidrate
POM_NAME         = AndroidRate Library
JAVADOC_BY_DOKKA = false

Set JAVADOC_BY_DOKKA to "true" to generate documentation by Dokka. Dokka is a documentation engine for Kotlin, it fully supports mixed-language Java/Kotlin projects.

4.1 Other gradle.properties in each module (optional)

You can add POM_PACKAGING (default is "aar" for Gradle Android Artifacts and "jar" for Gradle Java Artifacts and Gradle Kotlin Artifacts) and change it's value. Depends on Gradle/Plugins versions this option: 1. Changes <packaging> tag in the generated pom file only; 2. Changes main artifact file extension and <packaging> tag in the generated pom file; 3. Changes main artifact and it's asc file extensions and change <packaging> tag in the generated pom file;

Add VAR_ARTIFACT (default is "true") and set it to "true" to generate Gradle Android Artifact var. You'll get both POM_PACKAGING value (default is "aar" for Gradle Android Artifacts) and "var" artifacts in your Android library project.

Add ANDROID_JAR_ARTIFACT (default is "false") and set it to "true" to generate Gradle Android Artifact jar. You'll get both POM_PACKAGING value (default is "aar" for Gradle Android Artifacts) and "jar" artifacts in your Android library project.

Add ANDROID_JAR_MAIN_CLASS (example "com.vorlonsoft.android.rate.AppRate", default is "") and set it to ${package}.${main-class-name} to add "Main-Class" attribute to Android's "var", "jar" and "fatjar" MANIFEST.MF files.

Add FATJAR_ARTIFACT (default is "false") and set it to "true" to generate fatjar. You'll get both POM_PACKAGING value (default is "aar" for Gradle Android Artifacts and "jar" for Gradle Java Artifacts and Gradle Kotlin Artifacts) and "fatjar" artifacts.

Add APKLIB_ARTIFACT (default is "false") and set it to "true" to generate Gradle Android Artifact apklib. You'll get both POM_PACKAGING value (default is "aar" for Gradle Android Artifacts) and "apklib" artifacts in your Android library project. apklib is a way to bundle an Android library project.

Also you can set POM_ARTIFACT_URL (default is POM_ARTIFACT_ID value), this is makes to easier to have an artifact with one artifactId but the name on JCenter something else.

5. Call the script from each module's build.gradle

Add the following at the end of each build.gradle that you wish to upload:

apply from: 'https://raw.github.com/Vorlonsoft/GradleMavenPush/master/maven-push.gradle'

6. Build and Deploy/Install

You can now build and deploy on JCenter, Maven Central or Corporate staging/snapshot servers:

$ gradle deployOnServerRepository

Build and install on local Maven (~/.m2/repository/):

$ gradle installOnLocalRepository

Build and deploy on local Maven (~/.m2/repository/):

$ gradle deployOnLocalRepository

6.1 Inter-module dependency (optional)

If your modules have dependencies on each other (e.g. implementation project(':other_module')), then you should do one of the following for proper POM generation

  • option A: add to top level build.gradle:
allprojects {
    group = GROUP
    version = VERSION_NAME
}
  • option B: add to top level gradle.properties:
group   = com.vorlonsoft
version = 1.2.0

Other properties (optional)

There are other properties which can be set:

Repositories urls

RELEASE_REPOSITORY_URL (defaults to Maven Central's or JCenter's staging server (depends on IS_JCENTER))
SNAPSHOT_REPOSITORY_URL (defaults to Maven Central's or JCenter's snapshot server (depends on IS_JCENTER))

Javadoc generation

DOCLINT_CHECK (default is "false")
JAVADOC_ENCODING (default is "UTF-8")
JAVADOC_DOC_ENCODING (default is "UTF-8")
JAVADOC_CHARSET (default is "UTF-8")

Java 9+. This option assume that the HTML in the document comments is of the same version (4 or 5). It doesn't convert the HTML in the user documentation comments to the specified output version.

JAVADOC_HTML_VERSION (default is "4")

Dokka documentation engine

Dokka fatjar version. Latest version is Dokka fatjar latest version

DOKKA_FATJAR_VERSION (default is "0.9.17")

Dokka output format. Options are:

  • html - minimalistic html format used by default
  • javadoc - Dokka mimic to javadoc
  • html-as-java - as html but using java syntax
  • markdown - Markdown structured as html
    • gfm - GitHub flavored markdown
    • jekyll - Jekyll compatible markdown
  • kotlin-website - internal format used for documentation on kotlinlang.org
DOKKA_OUTPUT_FORMAT (default is "javadoc")

Snapshots names

POM_GENERATE_UNIQUE_SNAPSHOTS (default is "true")

Project Information

POM_INCEPTION_YEAR (default is "")

Organization

POM_ORG (default is "")
POM_ORG_URL (default is "")

Licenses

POM_LICENCE_DIST (default is "repo")
POM_LICENCE_COMMENTS (default is "")

Developers

POM_DEVELOPER_URL (default is "")
POM_DEVELOPER_ORG (default is POM_ORG value)
POM_DEVELOPER_ORG_URL (default is POM_ORG_URL value)
POM_DEVELOPER_ROLE (default is "Software Developer")
POM_DEVELOPER_ROLES (example "Software Architect,Software Developer", default is POM_DEVELOPER_ROLE value)
POM_DEVELOPER_TIMEZONE (default is "")

2nd, 3rd, etc developers, only id, name and email separated by comma.

POM_DEVELOPERS (example "BillG,Bill Gates,[email protected],SteveJ,Steve Jobs,[email protected]", default is "")

Contributors

Contributors, only name and email separated by comma.

POM_CONTRIBUTORS (example "Bill Gates,[email protected],Steve Jobs,[email protected]", default is "")

Issue Management

POM_ISSUE_SYSTEM (default is "")
POM_ISSUE_SYSTEM_URL (default is "")

Continuous Integration Management

POM_CI_SYSTEM (default is "")
POM_CI_SYSTEM_URL (default is "")

Mailing Lists

Mailing Lists, only name, subscribe email and unsubscribe email separated by comma.

POM_MAILING_LISTS (example "Main,[email protected],[email protected],Support,[email protected],[email protected]", default is "")

Software Configuration Management

Connection element convey to how one is to connect to the version control system through Maven.

POM_SCM_DEV_CONNECTION (default is POM_SCM_CONNECTION value)

Specifies the tag that this project lives under. HEAD (meaning, the SCM root).

POM_SCM_TAG (default is "HEAD")

A publicly browsable repository.

POM_SCM_URL (default is POM_URL value)

Repositories

Repositories in the Release pom file, only id and url separated by comma.

POM_REPOSITORIES (example "mavenCentral,https\://repo1.maven.org/maven2/,jCenter,https\://jcenter.bintray.com/", default is "")

Repositories in the Snapshot pom file, only id and url separated by comma.

POM_SNAPSHOT_REPOSITORIES (example "mavenCentral,https\://oss.sonatype.org/content/repositories/snapshots/,jCenter,https\://oss.jfrog.org/artifactory/oss-snapshot-local/", default is POM_REPOSITORIES value)

Distribution Management

This is the url of the repository from whence another POM may point to in order to grab this POM's artifact.

POM_DIST_DOWNLOAD_URL (default is "")

Groovydoc documentation

See GradleMavenPush documentation

Already in use in following libraries

Our other plugins

EasyDokkaPlugin - Gradle Script plugin to generate documentation by Dokka documentation engine in Javadoc or other formats for Java, Kotlin, Android and non-Android projects. It's very easy, you don't need to add to dependencies section additional classpath or think about compatibility issues, you don't need additional repositories also.

Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Copyright 2018 Vorlonsoft LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.
eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.

eventbus-intellij-plugin Plugin to navigate between events posted by EventBus. Post to onEvent and onEvent to Post Install There are two ways. Prefere

This plugin helps tp build GraphQL applications in Java using the DGS framework

dgs-intellij-plugin This plugin helps tp build GraphQL applications in Java using the DGS framework. The DGS Framework is open sourced by Netflix and

A solution to fix obfuscated Java services after ProGuard has run

ProGuard Service Mapper This is a service mapper for the ProGuard Java bytecode

CKlib is a gradle plugin that will build and package C/C++/Objective-C code for Kotlin/Native.

C Klib CKlib is a gradle plugin that will build and package C/C++/Objective-C code for Kotlin/Native. The Problem When you want to access C-etc code f

🤹 Common Kotlin utilities made for my personal usage, comes with SLF4J utilities, common extensions, common Gradle utilities, and more.

🤹 common-utils Common Kotlin utilities made for my personal usage, comes with SLF4J utilities, common extensions, ansi-colours, common Gradle utiliti

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.

Gradle Play Publisher Gradle Play Publisher is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and

[Deprecated] Android Studio IDE support for Android gradle unit tests. Prepared for Robolectric.
[Deprecated] Android Studio IDE support for Android gradle unit tests. Prepared for Robolectric.

#[Deprecated] Google has finally released a proper solution for unit testing. Therefore this plugin will no longer be activlty maintained. android-stu

 Gradle plugin which downloads and manages your Android SDK.
Gradle plugin which downloads and manages your Android SDK.

DEPRECATED This plugin is deprecated and is no longer being developed. Tools and dependencies are automatically downloaded using version 2.2.0 of the

Android gradle version and plugins

android-gradle-plugin Android gradle version and plugins Version catalogs Shared catalogs 를 사용한 android version catalogs 입니다. Usage settings.gradle.kt

Comments
  • Pushing a Kotlin library does not work (Mixed aar/jar artifacts)

    Pushing a Kotlin library does not work (Mixed aar/jar artifacts)

    The generated repo contains a .jar file, but .aar.asc. So it complains about a missing signature for the main artifact.

    Is this a known issue with kotlin?

    bug 
    opened by danielgindi 4
  • Plugin doesn't work with gradle 5.1.1

    Plugin doesn't work with gradle 5.1.1

    Cause: startup failed:
    script 'https://raw.github.com/Vorlonsoft/GradleMavenPush/master/maven-push.gradle': 339: The variable [srcDirsJavaNumber] may be uninitialized
    . At [339:17]  @ line 339, column 17.
                       srcDirsJavaNumber = (byte) ((android.sourceSets.main.java.srcDirs != null) ? android.sourceSets.main.java.srcDirs.size() : 0)
                       ^
    
    1 error
    
    
    opened by VovaStelmashchuk 1
Releases(Yokohama)
  • Yokohama(Aug 17, 2018)

    • LIBff60817 maven-push.gradle detectable by GitHub Linguist library
    • LIBff50817 .gitattributes file for GitHub Linguist library added
    • LIBff40817 Groovydocs added
    • LIBff30817 Ant Build file for groovydoc added
    • LIBcc20817 isAndroid() check added to MavenPush Class methods
    • LIBff20817 "var" Gradle Android Artifact support
    • LIBff10817 *.cpp and *.groovy files support
    • LIBcc10817 Cleaning
    • LIBff10816 Pull request from EasyDokkaPlugin
    • LIBcc30816 Inspection
    • LIBcc20816 Documenting
    • LIBcc10815 Documenting
    • LIBcc50814 README.md update
    • LIBcc40814 downloadLib(...) method update
    • LIBcc10814 downloadLib(...) method update
    • LIBff10814 Process AAR dependencies
    • LIBbb10814 Sets the artifacts base file name to match the artifact ID in any case
    • LIBff10808 dokka tasks merged
    • LIBff90807 sources tasks merged
    • LIBff80807 apklib tasks merged
    • LIBff60807 MavenPushInitializer Class added
    • LIBcc20807 isAndroid() added
    • LIBbb10807 Can't find isAndroid()
    • LIBff50807 MavenPushUtils Class added
    • LIBff40807 InvalidUserDataException class added
    • LIBff30807 Move getJavaAPISpecificationLink(...) to MavenPush Class
    • LIBff20807 Move MavenPush Class out
    • LIBff10807 Refactoring
    • LIBff40806 compileOnly excluded from fatjar
    • LIBbb30806 GROUP and VERSION_NAME default values updated
    • LIBcc30806 static pomFinalizer(...) added
    • LIBff30806 ANDROID_JAR_MAIN_CLASS added to add "Main-Class" attribute to Android's "var", "jar" and "fatjar" MANIFEST.MF files.
    • LIBff20806 non-Android fatjar manifest update
    • LIBcc10805 "Our other pligins" section added
    • LIBbb10805 isAndroid() checks added
    Source code(tar.gz)
    Source code(zip)
  • 1.5.0.Tokyo(Aug 3, 2018)

    • LIBcc30803 "Already in use in following libraries" section update
    • LIBcc20803 .gradle added to .gitignore
    • LIBff20803 Optimization and refactoring
    • LIBcc10803 .gitignore changed
    • LIBff10803 Add MavenPush.groovy Groovy Class
    • LIBff40731 Add "6.2 Dokka configuration (optional)" section to README.md
    • LIBcc30731 Add description about POM_PACKAGING property.
    • LIBff30731 Added Gradle Android/Java/Kotlin Artifact fatjar option
    • LIBff20731 Build and Deploy/Install gradle commands update
    • LIBcc20731 README.md update
    • LIBcc10731
    • LIBff10731 Added Gradle Android Artifact jar option
    • LIBbb20728 isKotlin() updated
    • LIBcc20728 Kotlin source paths updated
    • LIBcc10728 Inspection
    • LIBff20728 Tasks for dokka-android and dokka plugins added
    • LIBbb10728 Kotlin sources packaging update
    • LIBff10728 dokkaInitializer added
    • LIBff10726 Dokka support added. Documentation engine for Kotlin, supports Java/Kotlin projects.
    • LIBff20724 JAVADOC_HTML_VERSION property. Javadoc HTML4/HTML5 options for Java 9+.
    • LIBff10724 sources.jar for Android Kotlin projects
    • LIBcc30724 Set the archives configuration.
    • LIBcc20724 Sort tags in pom files
    • LIBcc10724 API Key for JCenter, not password
    • LIBcc30723 Move dependencies section at the bottom of pom files
    • LIBbb10723 Add Javadoc boolean option ('html4', true) for Java 9+
    • LIBcc20723 "Already in use in following libraries" section of README.md update
    • LIBcc10723 "Other Properties" section of README.md update
    • LIBff30723 Add Distribution Management section to pom file
    • LIBff20723 Add POM_SNAPSHOT_REPOSITORIES property for Repositories section of pom file
    • LIBff10723 Add Repositories section to pom file
    • LIBcc40722
    • LIBbb10722 Pom file generation update
    • LIBcc30722 POM_DEVELOPER_ROLE and POM_DEVELOPER_ROLES code update
    • LIBff20722 POM_SCM_TAG (Default is "HEAD") added. Specifies the tag that this project lives under. HEAD (meaning, the SCM root) should be the default.
    • LIBff10722 Inception Year, Additional Developers, Contributors, CI Management, Mailing Lists, LicenseComments, DeveloperUrl, DeveloperTimezone added to pom
    • LIBff10721 Javadoc docEncoding can be set
    • LIBcc20721
    • LIBbb20721 Javadoc generation update
    • LIBcc10721 Default pomConfig for pom files
    • LIBbb10721 Fix javadoc for Gradle Java Artifacts
    • LIBff20720 Ability to generate Gradle Android Artifact apklib
    • LIBbb10720 Set POM_PACKAGING default to "jar" for Gradle Java Artifacts
    • LIBcc10720 Remove unnecessary requests to properties
    • LIBff10720 Option to add Issue tracking system to pom file
    • LIBbb10719 Remove empty pom tags
    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Jul 19, 2018)

    • LIBcc10719 Default developer role update
    • LIBff20719 Inter-module dependency
    • LIBff10719 Add JCenter option
    • LIBff30718 Configuration for java plugin
    • LIBff20718 Allow for multiple developer roles
    • LIBbb20718
    • LIBcc10718 README.md update
    • LIBff10718 Support both android and java projects
    • LIBbb10718 Set failOnError to "false" for task androidJavadocs
    • LIBbb10717 Fix for "No signature of method: java.lang.Object.uniqueVersion() is applicable for argument types: (java.util.Collections$EmptyMap, java.lang.Boolean) values: [[:], true]"
    • LIBcc10717
    • LIBff10717 Add installArchives task which installs jars/aars in local repo
    • LIBff30715 Add lookup to set uniqueVersion
    • LIBff20715 POM_ORG, POM_ORG_URL and POM_DEVELOPER_ROLE added
    • LIBbb10715 Workaround for "Given organization in generated POM is evaluated to org.apache.maven.model.Organization.toString()"
    • LIBff10715 Add properties getters to use gradle.build values
    • LIBff50714 Adding developer metadata to pom
    • LIBcc70714
    • LIBff40714 Javadoc encoding and charSet can be set
    • LIBff30714 Disable doclint in JDK 8 Javadoc
    • LIBff20714 Add javadoc charset
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Jul 14, 2018)

Owner
Vorlonsoft LLC
Software development and IT consulting
 Vorlonsoft LLC
An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play.

DroidLane An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play. Installation Open Android Studio or IntelliJ IDEA O

Jintin 24 Jul 26, 2021
Kotlin Multiplatform (pending KSP support) snapshot (klip) manager for tests

KLIP Kotlin Multiplatform (pending KSP support) snapshot (klip) manager for tests Modules core - runtime library processor - ksp-based annotation proc

Martynas Petuška 23 Nov 25, 2022
Provides a shortcut to copy permalink in their online Git repositories from inside IDE.

Copy Git Link Provides a shortcut to copy permalink in their online Git repositories from inside IDE. Works with: GitHub GitLab Bitbucket My.Movie.4.3

ryo 13 Jan 3, 2023
A flutter plugin through which you can get audios, videos, or images from the local storage.

Getter Made flutter easier. Description A flutter plugin through which you can get audios, videos or images from the local storage. Dependencies Befor

Younes Lagmah 3 Sep 11, 2021
Gradle Replace In Place (GRIP): a gradle plugin to update your documentation or any file with a simple gradle task

GRIP (Gradle Replace In-Place) A gradle tool to update some values in your (documentation) files by running a task. (inspired by Knit) Directives Inse

Grégory Lureau 2 Oct 18, 2022
Maven Plugin for Android Application development and more

ANDROID MAVEN PLUGIN A plugin for Android application development with Apache Maven 3.0.5+ and the Android SDK. Please check out our website for furth

simpligility 1k Jan 4, 2023
Maven Archetypes for Android development

android-archetypes This projects provides several Maven archetypes for Android. Those archetypes allows to quickly bootstrap a Maven project to develo

akquinet AG 444 Nov 25, 2022
Android for Maven Eclipse

#Android for Maven Eclipse Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Ricardo Gladwell, Hugo Josefson, Anthony Dannane, Mykola Nikishov, R

Ricardo Gladwell 338 Nov 25, 2022
gradle-android-scala-plugin adds scala language support to official gradle android plugin

gradle-android-scala-plugin gradle-android-scala-plugin adds scala language support to official gradle android plugin. See also sample projects at htt

saturday06 345 Dec 10, 2022
Ownership-gradle-plugin - Gradle code ownership verification plugin

Gradle code ownership verification plugin A gradle plugin that will verify owner

null 4 Dec 15, 2022