Skip to content

Latest commit

 

History

History
135 lines (97 loc) · 3.91 KB

README.md

File metadata and controls

135 lines (97 loc) · 3.91 KB

yourmd-gradle-scripts

This repository contains common gradle scripts that can be used in real-projects to reduce build boilerplate.

Included scripts

script description
/gradle/common.gradle common build.gradle settings, required
/gradle/java.gradle common build.gradle settings for java projects, requires inclusion of common.gradle
/gradle/docker.gradle docker image tagging support, requires inclusion of common.gradle
/gradle/jib.gradle docker jib support, requires inclusion of common.gradle

See src/main/resources/gradle directory for details.

How to "compile"

Clone this project and install artifact jar into local maven repository:

./gradlew clean publishToMavenLocal

How to use

//
// build.gradle
//

buildscript {
    // required to apply gradle snippets stored in md.your.gradle:common-settings jar
    repositories {
      mavenLocal()
      mavenCentral()
    }
    dependencies {
      classpath "md.your.gradle:common-settings:<version>"
    }
}

plugins {
    id "net.researchgate.release"           version  "3.0.2" // gradle release plugin (required)
    id "io.spring.dependency-management"    version  "1.1.0" // dependency management plugin (required)
}


// apply default settings from jar
apply from: getClass().getResource("/gradle/common.gradle")
apply from: getClass().getResource("/gradle/java.gradle")

// DONE!
//
// This is enough to build/test/publish almost all java/groovy projects :)
// You should probably add your custom dependencies, though. 
// 

Batteries included

This project reduces gradle build script boilerplate, so it configures most annoying stuff for your out-of-the-box.

Configured repositories

  • mavenLocal
  • mavenCentral
  • ymdreleases (S3)
  • ymdsnapshots (S3)

Automatically enabled plugins

Gradle tasks

task description
awsCredentials displays AWS credentials
repositories displays all configured repositories
downloadDeps downloads all required dependencies
wrapper install/configure gradle wrapper

Dependency management

All dependencies are managed, so you don't need to provide dependency versions, so everybody using this project ends up with the same dependency set.

Automatically enabled dependencies

dependency scope enabled dependencies
compileOnly
testCompile
  • org.slf4j:slf4j-api
  • org.codehaus.groovy:groovy-all
  • org.spockframework:spock-core
  • org.assertj:assertj-core

How to deploy to maven OSSRH

via gradle.properties

Add the following to your ~/.gradle/gradle.properties:

osshr.user=<osshr_jira_username>
osshr.pass=<osshr_jira_password>

signing.gpg.key.content=<base64 encoded GPG private key>
signing.gpg.key.password=<GPG private key password>

via env variables

set up the following env vars:

OSSHR_USER=<osshr_jira_username>
OSSHR_PASS=<osshr_jira_password>

SIGNING_GPG_KEY_CONTENT=<base64 encoded GPG private key>
SIGNING_GPG_KEY_PASSWORD=<GPG private key password>

Then upload Sonatype OSSHR using:

./gradlew publish