• Stars
    star
    131
  • Rank 275,867 (Top 6 %)
  • Language
  • License
    BSD 3-Clause "New...
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gradle 5.x Maven Publish Plugin to deploy artifacts

Gradle Maven Plugin

This is a small "plugin" to simplify the use of maven-publish Gradle plugin. You can use this plugin for Java Library and Android Library.

Index

Usage

In order to use GradleMavenizer you have to add the line

apply from: 'https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/master/gradle-mavenizer.gradle'

at the very bottom of the build.gradle file. Alternatively, to use a specific release version, add this property to the project (see Releases at the top of the Github page for released versions):

mavPluginVersion = '1.2.0'

and add this line to the very bottom of the build.gradle file:

apply from: "https://raw.githubusercontent.com/sky-uk/gradle-maven-plugin/${project.mavPluginVersion}/gradle-mavenizer.gradle"`

Customization

GradleMavenizer is highly customizable.

You can customize it adding some properties to the root project build.gradle or to the module build.gradle file.

Attention: If you add the same property to the root project file and to the module file, in order of priority, the module file property will override the root project property.

1. Generic Project Info (included in POM)

  • mavProjectName -> String property -> Identify the project name (can be different from the artifactId)
  • mavLibraryDescription -> String property -> A simple description for the library
  • mavDevelopers -> Map property -> A map with the ids and the developer name of the library
  • mavLibraryLicenses -> Map property -> A map with the name and the urls of the library licenses
  • mavSiteUrl -> String property -> Identify the url of the project website
  • mavGitUrl -> String property ->Identify the url of the project github page

2. Repositories

  • Remote repository:

    • mavPublishToRemoteRepo -> Boolean property -> Allow the script to load your library to a remote repo
    • mavRemoteRepoUser -> String property -> Username to grant access to the remote repo
    • mavRemoteRepoPassword -> String property -> Password to grant access to the remote repo
    • mavRepoRemoteUrl -> String property -> Identify the url of the remote repo
  • Internal repository:

    • mavPublishToInternalRepo -> Boolean property -> Allow the script to load your library to an internal repo
    • mavRepoInternalUrl -> String property -> Identify the url of the internal repo
  • MavenLocal repository:

    • mavPublishToMavenLocal -> Boolean property -> Allow the script to load your library to MavenLocal folder

Attention: If you won't set any repository automatically the script will use MavenLocal as default repo

Example of per-module build.gradle costumization

project.ext {
    mavDevelopers = ["Fe":"Federico"]
    mavSiteUrl = "https://github.com/sky-uk/gradle-maven-plugin"
    mavGitUrl = mavSiteUrl + '.git'
    mavProjectName = 'GradleMavenizer'
    mavPublishToInternalRepo = true
    mavRepoInternalUrl = "path/to/internal/repo"
    mavLibraryLicenses = ["Apache-2.0":'http://www.apache.org/licenses/LICENSE-2.0.txt']
    mavLibraryDescription = "A simple description of the project"
}

Library Publish

To finally publish you library you can use the command ./gradlew publish directly from your project root folder.

You can also pass some properties directly from command line using the command -P (every property must have -P before), for example: ./gradlew publish -PmavPublishToMavenLocal=true

Maven Central Publish

Follow this guide if you need to get a Sonatype account and generate a GPG key. Those matters are out of scope here.

In your project root, add local.properties (make sure to ignore it in your repo and not commit it) with the following content:

signing.keyId=ABCDEFGH
signing.password=yourPassword
signing.secretKeyRingFile=/path/to/ABCDEFGH.gpg

mavRepoRemoteUrl=https://oss.sonatype.org/service/local/staging/deploy/maven2/
mavRemoteRepoUser=yourSonatypeUsername
mavRemoteRepoPassword=yourSonatypePassword

Then to publish a staging repository on Maven Central execute:

./gradlew publish -PmavSigning=true -PmavPublishToRemoteRepo=true --max-workers 1

The --max-workers 1 setting is important to ensure the publication does not get split in multiple publications when using gradle parallel builds, resulting in many stagng repositories on sonatype. It's always advised to specify it.

After you executed the command, you can browse and review what's been uploaded by visiting https://oss.sonatype.org/#stagingRepositories

Generate POM file

If you want to generate the POM file without publish your library you can use the command ./gradlew generatePomFileForMavenPublishPublication directly from your project root folder.

To generate the POM file only for one module of your library you can use the command ./gradlew your-module-name:generatePomFileForMavenPublishPublication where you have to replace your-module-name with the name you chose for your module.

Note: POM file will be saved in build/publications/mavenPublish/ as pom-default.xml

More Repositories

1

css

Believe in Better CSS
JavaScript
278
star
2

anticipy

A Python library for time series forecasting
Python
82
star
3

ReactiveAPI

Write clean, concise and declarative network code relying on URLSession, with the power of RxSwift. Inspired by Retrofit.
Swift
79
star
4

feed

Nginx based Kubernetes ingress controller for AWS
Go
58
star
5

osprey

Kubernetes OIDC CLI login
Go
51
star
6

cqlmigrate

Cassandra schema migration library
Java
46
star
7

api-explorer

API Explorer is a live documentation client for Swagger/OpenAPI Specification
JavaScript
44
star
8

kafka-configurator

Kafka Topic Configurator
Scala
32
star
9

kafka-message-scheduler

Scheduler for low-frequency and long-term scheduling of delayed messages to Kafka topics.
Scala
32
star
10

mite

Mite - A Python Performance Testing Framework
Python
25
star
11

bslint

A linter for the BrightScript language.
Python
24
star
12

terraform-provider-nsx

A Terraform provider for VMware NSX.
Go
20
star
13

ruby-bootcamp

Ruby
18
star
14

nemo

Rendering form elements and validating user input. It supports a modified version of the siren data structure to dynamically construct the form.
JavaScript
18
star
15

docker-registry-exporter

Prometheus exporter for docker registry
Python
17
star
16

client-lib-ios-test-foundation

Sky Italia Test Foundation Framework for iOS
Swift
17
star
17

merlin

Distributed IPVS Loadbalancer
Go
16
star
18

terraform-provider-infoblox

Terraform Infoblox provider
Go
15
star
19

clusterverse

Full-lifecycle cloud infrastructure cluster management, using Ansible
Groovy
15
star
20

kfp-operator

Go
15
star
21

architecting-css

Examples as part of my Architecting CSS presentation for Online Services
CSS
14
star
22

supercell

Grid-like Layout System
CSS
14
star
23

vergo

Go
12
star
24

vagrant-vrealize

VRealize provider plugin for Vagrant
Ruby
10
star
25

what-bump

Detect required version bump based on conventional commit messages
Rust
10
star
26

terraform-provider-vrealize

Terraform vRealize provider
Go
9
star
27

etcd-bootstrap

bootstrap etcd nodes in the cloud
Go
8
star
28

cezanne

Visual regression testing tool
Ruby
7
star
29

android-tdd-introduction

Java
7
star
30

govrealize

A Go library for interacting with vRealize Automation 6.2 REST API
Go
6
star
31

gonsx

Go library for VMware vSphere NSX API
Go
6
star
32

csp-tech-radar

The Sky Plc Content Supply Platforms department technology radar.
6
star
33

terraform-provider-pulsevtm

Terraform PulseVTM provider
Go
5
star
34

go-pulse-vtm

Go Bindings for Pulse Secure Virtual Traffic Manager
Go
5
star
35

licence-compliance-checker

Validate project dependencies licence compliance
Go
4
star
36

kafka-topic-loader

Reads the contents of provided Kafka topics
Scala
4
star
37

q-go-assessment

Assessment Project for QGo Desktop Team
JavaScript
4
star
38

front-end

A forum for best practice of Front End Development within Sky.
3
star
39

cleanup-docker-registry

Shell
2
star
40

droidcon-streaming-app

Sample code from #DroidconUK15 presentation by Andrew Jack
Java
2
star
41

fs2-kafka-topic-loader

Reads the contents of provided Kafka topics
Scala
2
star
42

skyinfoblox

Go library for the Infoblox appliance
Go
2
star
43

scio-tests

Scala
1
star
44

go-rest-api

A fairly generic HTTP API
Go
1
star
45

fluentd-docker

Fluentd docker image with plugins : prometheus, rewrite-tag and elasticsearch
Go
1
star