Skip to content

Instantly share code, notes, and snippets.

@Jire
Last active July 29, 2016 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jire/99abc59e24398bc0704b2d5d9cc15e99 to your computer and use it in GitHub Desktop.
Save Jire/99abc59e24398bc0704b2d5d9cc15e99 to your computer and use it in GitHub Desktop.
My Java/Kotlin build.gradle boilerplate for BinTray
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/
buildscript {
ext.your_name = 'Your Name'
ext.your_email = 'youremail@email.com'
ext.your_github_name = 'YourUsername'
ext.project_name = 'YourProjectName'
ext.project_description = 'A description of your project'
ext.project_group = 'your.project.group'
ext.project_artifact = 'yourartifact'
ext.project_version = '1.0.0'
ext.project_license = 'The Apache Software License, Version 2.0' // the full license name
ext.project_license_tag = 'Apache-2.0' // the license tag name
ext.project_license_url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' // link to the license
ext.kotlin_version = '1.0.3'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
plugins {
id "com.jfrog.bintray" version "1.7"
}
group project_group
version project_version
allprojects {
repositories {
jcenter()
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'java'
apply plugin: 'kotlin'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
maven(MavenPublication) {
from components.java
groupId project_group
artifactId project_artifact
version project_version
artifact sourcesJar
artifact javadocJar
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name project_name
description project_description
url "https://github.com/$your_github_name/$project_name"
scm {
url "https://github.com/$your_github_name/$project_name"
connection "scm:git:git://github.com/$your_github_name/${project_name}.git"
developerConnection "scm:git:ssh:git@github.com:$your_github_name/${project_name}.git"
}
licenses {
license {
name project_license
url project_license_url
distribution 'repo'
}
}
developers {
developer {
id your_github_name
name your_name
email your_email
}
}
}
}
}
}
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_API_KEY')
publications = ['maven']
pkg {
repo = 'maven'
name = project_name
desc = project_description
licenses = [project_license_tag]
publicDownloadNumbers = true
websiteUrl = "https://github.com/$your_github_name/$project_name"
issueTrackerUrl = "https://github.com/$your_github_name/$project_name/issues"
vcsUrl = "https://github.com/$your_github_name/${project_name}.git"
githubRepo = "$your_github_name/$project_name"
version {
name = project_version
vcsTag = project_version
gpg {
sign = true
}
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment