Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
# JCenter
build scripts to upload artifacts to jcenter.

From In The Cheese Factory [blog post](http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en)

# Prerequisites
Read the blog post linked above first. You need to have following properties, how to get that is described in the post.

# Personal or ownership information
- `bintrayUser` (A Bintray user name)
- `bintrayApiKey` (Bintray API key)
- `bintrayGpgPassword` (A GPG signing mechanism, and it's passphrase)
- `DEVELOPER_EMAIL` (developer email)

# Library information
- `GROUP`(Group id of your library)
- `POM_ARTIFACT_ID` (POM Artifact Id-better to keep it in lowercase)
- `POM_NAME`
- `POM_DESCRIPTION`
- `POM_URL`
- `POM_DEVELOPER_ID`
- `POM_DEVELOPER_NAME`
- `DEVELOPER_EMAIL`
- `POM_SCM_URL`

# Where should I keep these properties?
If you put these information in gradle.properties this script can read it easily.

The best place to put Personal or ownership information in system's build.gradle file, so that it does not go with source control.
For windows it's located at
C:\Users\{UserName}\.gradle\gradle.properties

For Library information it's better to create gradle.properties in your library module and put all the information there.

# Is there any example?
Yes, See [android external file writer repository](https://github.com/PrashamTrivedi/AndroidExternalFileWriter)

# Everything is set, what should I do to upload a file in bintray.
Just open a command prompt, cd to your library directory and run
`..\gradlew clean build bintrayUpload`
70 changes: 42 additions & 28 deletions bintrayv1.gradle
Original file line number Diff line number Diff line change
@@ -1,51 +1,65 @@
apply plugin: 'com.jfrog.bintray'

version = libraryVersion
version = VERSION_NAME

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
// Bintray Properties. Gradle can read properties from anywhere

def getBintrayUserName(){
return hasProperty('bintrayUser') ? bintrayUser : ""
}
artifacts {
archives javadocJar
archives sourcesJar

def getApiKey(){

return hasProperty('bintrayApiKey') ? bintrayApiKey : ""
}

// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def getGpgPassword(){

return hasProperty('bintrayGpgPassword') ? bintrayGpgPassword : ""
}
afterEvaluate{
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
user = getBintrayUserName()
key = getApiKey()

configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
repo = 'maven'
name = POM_NAME
desc = POM_DESCRIPTION
websiteUrl = POM_URL
vcsUrl = POM_SCM_URL
licenses = ["Apache-2.0"]
publish = true
publicDownloadNumbers = true
version {
desc = libraryDescription
desc = POM_DESCRIPTION
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = properties.getProperty("bintray.gpg.password")
passphrase = getGpgPassword()
//Optional. The passphrase for GPG signing'
}
}
}
}
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
}
28 changes: 14 additions & 14 deletions installv1.gradle
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
apply plugin: 'com.github.dcendents.android-maven'

group = publishedGroupId // Maven Group ID for the artifact
group = GROUP // Maven Group ID for the artifact

install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
groupId publishedGroupId
artifactId artifact
groupId GROUP
artifactId POM_ARTIFACT_ID

// Add your description here
name libraryName
description libraryDescription
url siteUrl
name POM_NAME
description POM_DESCRIPTION
url POM_URL

// Set your license
licenses {
license {
name licenseName
url licenseUrl
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
id POM_DEVELOPER_ID
name POM_DEVELOPER_NAME
email DEVELOPER_EMAIL
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
connection POM_SCM_URL
developerConnection POM_SCM_URL
url POM_URL

}
}
Expand Down