Skip to content

Commit

Permalink
Add bintray plugin for publishing and configure the bintray closure
Browse files Browse the repository at this point in the history
  • Loading branch information
kennedykori committed Sep 23, 2019
1 parent 779ba05 commit f23efd1
Showing 1 changed file with 103 additions and 5 deletions.
108 changes: 103 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,35 @@ plugins {
id 'java-library'
// Apply the jacoco plugin to aid in test coverage
id 'jacoco'
// Apply the maven publish plugin
id 'maven-publish'
// Apply the bintray plugin
id "com.jfrog.bintray" version "1.8.4"
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

group = 'com.kori_47'
version = '1.0'

repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
mavenLocal()
}

dependencies {
// Use JUnit test framework
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2' //'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
useJUnitPlatform()
testLogging {
events 'passed', 'skipped', 'failed'
}
}

jacocoTestReport {
Expand All @@ -41,3 +49,93 @@ jacocoTestReport {
xml.enabled true
}
}

// Configure sources JAR
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allJava
}

// Configure javadoc Jar
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// Create the pom configuration:
def pomConfig = {
licenses {
license {
name 'MIT'
url 'https://github.com/kennedykori/JavaUtils/blob/master/LICENSE'
distribution "repo"
}
}
developers {
developer {
id 'kennedykori'
name "Kennedy Kori"
email '[email protected]'
}
}

scm {
url 'https://github.com/kennedykori/JavaUtils'
}
}

publishing {
publications {
UtilsPublication(MavenPublication) {
from components.java
// Attach sources and javadoc Jars to the main maven publication
artifact sourcesJar
artifact javadocJar

groupId 'com.kori_47'
artifactId 'utils'
version '1.0'

pom.withXml {
def root = asNode()
root.appendNode('description', 'This library contains a utility class that is composed of static methods that can be used for checking and validation of both objects and primitives.')
root.appendNode('name', 'Utils')
root.appendNode('url', 'https://github.com/kennedykori/JavaUtils')
root.children().last() + pomConfig
}
}
}
}

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['UtilsPublication']
pkg {
repo = 'kori_47'
name = 'utils'
desc = 'This library contains a utility class that is composed of static methods that can be used for checking and validation of both objects and primitives.'
websiteUrl = 'https://github.com/kennedykori/JavaUtils'
issueTrackerUrl = 'https://github.com/kennedykori/JavaUtils/issues'
vcsUrl = 'https://github.com/kennedykori/JavaUtils.git'
licenses = ['MIT']
publicDownloadNumbers = true

githubRepo = 'kennedykori/JavaUtils'
githubReleaseNotesFile = 'README.md'

version {
name = '1.0-Final'
desc = 'Utils 1.0 final'
released = new Date()
// GPG Signing
gpg {
sign = true
}
// Maven Central Sync
mavenCentralSync {
sync = true
}
}
}
}

0 comments on commit f23efd1

Please sign in to comment.