I am sorry if I am being too stupid but I just can't make it work... I have an Android Module Project in AS that I want to upload to JCenter - using gradle bintray plugin from JFrog. I follow this tutorial in order to create the repository on bintray and I ended up with the following build.gradle for the module:
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty('bintray.user')
key = properties.getProperty('bintray.apikey')
configurations = ['published', 'archives']
dryRun = false
publish = true
pkg {
repo = 'maven'
name = 'custom-searchable'
desc = 'This repository contains a library that aims to provide a custom searchable interface for android applications'
websiteUrl = 'https://github.com/...'
issueTrackerUrl = 'https://github.com/.../issues'
vcsUrl = 'https://github.com/....git'
licenses = ['The Apache Software License, Version 2.0']
labels = ['android', 'searchable', 'interface', 'layout']
publicDownloadNumbers = true
version {
name = '1.0'
desc = 'Bintray integration test'
vcsTag = '1.0'
}
}
}
ext {
bintrayRepo = 'maven'
bintrayName = 'custom-searchable'
publishedGroupId = 'br.com.edsilfer'
libraryName = 'CustomSearchable'
artifact = 'custom-searchable'
libraryDescription = 'This repository contains a library that aims to provide a custom searchable interface for android applications'
siteUrl = 'https://github.com/...'
gitUrl = 'https://github.com/....git'
libraryVersion = '1.0'
developerId = '...'
developerName = '...'
developerEmail = '...'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:recyclerview-v7:21.0.3'
}
And this one for the project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
After running the task gradle bintrayUpload (it finishes sucessfully) my repository in bintray looks like that:
And when you open the unspecified folder you'll find this:
So questions!
Why version is being upload like unspecifiend?
I can't compile my project with the given group id:artifact:version, when trying to build it on AS it says that it fails to resolve the path to the artifact.
Any help will be appreciated!
You are using the standard configuration provided by the gradle plugin, which do not specify library version.
I'm using the publication instead:
...
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
...
bintray {
...
publications = ['Publication']
pkg {
...
}
}
publishing {
publications {
Publication(MavenPublication) {
artifact jar
groupId 'com.lib'
artifactId 'help-er'
version '0.1'
}
}
}
If you want to use configurations check this question: Publish on bintray using the gradle-bintray-plugin
Related
UPDATE2: I was not generating a aar file, now it's included in the package that you can check here: https://github.com/fabrizioiacobucci/range-bar-preference/packages/787218
I see javadoc, sources and aar are there, but when I add the package as dependency in another project I don't even see it in the External Libraries.
UPDATE: This is the problem, I don't see my source files in the downloaded jar:
I recently forked a little project on Github and migrated its old code version to AndroidX and new gradle build.
After some time everything work fine and I was able also to publish the library on Git packages.
However, I tried to declare it as dependency on a different project on my local computer. It downloads fine but when I try to import it in a source file, I cannot find the package:
If I go into the project folder I see the library downloaded and related files.
This is the Project build.gradle file of the published library.
build.gradle (project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
}
}
plugins {
id 'maven-publish'
}
apply from: "${rootDir}/scripts/publish-root.gradle"
apply plugin: 'io.github.gradle-nexus.publish-plugin'
ext {
VERSION = '1.0.0'
DESCRIPTION = 'A range bar that can be used as an android shared preference'
GROUPID = 'com.fabrizioiacobucci.android'
ARTIFACTID = 'range-bar-preference'
GITREPO = 'https://github.com/fabrizioiacobucci/tree/development/range-bar-preference.git'
PROJECTURL = 'https://github.com/fabrizioiacobucci/tree/development/range-bar-preference'
PUBLISHGIT = 1
PUBLISHMAVEN = 0
}
nexusPublishing {
repositories {
sonatype {
stagingProfileId = '1c4ab2dc896731'
//packageGroup = "com.fabrizioiacobucci.android"
username = ossrhUsername
password = ossrhPassword
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
build.gradle (module)
apply plugin: 'com.android.library'
android {
compileSdkVersion 30
buildToolsVersion '31.0.0 rc3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 30
version VERSION
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName VERSION
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'com.appyvet:materialrangebar:1.3'
implementation 'androidx.appcompat:appcompat:1.2.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.5.1'
}
apply from: "${rootDir}/scripts/publish-module-maven.gradle"
apply from: "${rootDir}/scripts/publish-module-githubpkg.gradle"
publish-module-maven.gradle
apply plugin: 'maven-publish'
apply plugin: 'signing'
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.srcDirs
classpath = configurations.compile
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
artifacts {
archives androidSourcesJar
archives javadocJar
}
afterEvaluate {
publishing {
publications {
release(MavenPublication) {
// The coordinates of the library, being set from variables that
// we'll set up later
groupId GROUPID
artifactId ARTIFACTID
version VERSION
artifact("$buildDir/outputs/aar/range-bar-preference-release.aar")
artifact androidSourcesJar
artifact javadocJar
// Mostly self-explanatory metadata
pom {
name = 'Range Bar Preference'
description = 'A range bar that can be used as an android shared preference'
url = PROJECTURL
groupId GROUPID
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'FabrizioIacobucci'
name = 'Fabrizio Iacobucci'
email = 'fabrizio.iacobucci90#mail.com'
}
}
scm {
connection = 'scm:git:github.com/fabrizioiacobucci/range-bar-preference.git'
developerConnection = 'scm:git:ssh://github.com/fabrizioiacobucci/range-bar-preference.git'
url = 'https://github.com/fabrizioiacobucci/range-bar-preference/'
}
}
}
}
}
}
ext["signing.keyId"] = rootProject.ext["signing.keyId"]
ext["signing.password"] = rootProject.ext["signing.password"]
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"]
signing {
sign publishing.publications
}
publish-module-githubpkg.gradle
artifacts {
archives androidSourcesJar
archives javadocJar
}
project.publishing {
publications {
maven(MavenPublication) {
groupId = GROUPID
artifactId = ARTIFACTID
version = VERSION
artifact("$buildDir/outputs/aar/range-bar-preference-release.aar")
artifact androidSourcesJar
artifact javadocJar
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
pom {
name = 'Range Bar Preference'
packaging = 'aar'
description = 'A range bar that can be used as an android shared preference'
url = PROJECTURL
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'FabrizioIacobucci'
name = 'Fabrizio Iacobucci'
email = 'fabrizio.iacobucci90#mail.com'
}
}
scm {
connection = 'scm:git:github.com/fabrizioiacobucci/range-bar-preference/range-bar-preference.git'
developerConnection = 'scm:git:ssh://github.com/fabrizioiacobucci/range-bar-preference/range-bar-preference.git'
url = 'https://github.com/fabrizioiacobucci/range-bar-preference/'
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri('https://maven.pkg.github.com/fabrizioiacobucci/range-bar-preference')
credentials {
username = System.getenv("GITHUB_USER")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
I don't know if there is anything else relevant to share, please let me know in case.
Do you have any idea what am I missing?
Thanks a lot in advance for any help.
As promised I forked the original project upgraded to android and then all the dependencies to the latest.
For the fast release of SDK to do the POC, I released it to jitpack.io
How to add the new library as a dependency.
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add this to your app module dependencies:
dependencies {
implementation 'com.github.dk19121991:range-bar-preference:0.0.7'
}
I did try it myself and it's working fine for me, I updated the app module in my forked version to use the library from jitpack only, and it's working smoothly.
Please try the library and let me know if you feel anything else you need.
https://github.com/dk19121991/range-bar-preference
import com.nfx.android.rangebarpreference
change fabrizioiacobucci to nfx will solve your poblem
I am trying to upload a android library automatically into bintray.
I have this app gradle code:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
ext {
bintrayRepo = 'maven'
bintrayName = 'CurrentCenterPositionMap'
publishedGroupId = 'renatamelo#patriauto.org'
libraryName = 'CurrentCenterPositionMap'
artifact = 'current-center-position-map'
libraryDescription = 'A library to mark the center of a map with moveing animations'
siteUrl = 'https://github.com/leandroBorgesFerreira/CurrentCenterPositionMap'
gitUrl = 'https://github.com/leandroBorgesFerreira/CurrentCenterPositionMap.git'
libraryVersion = '0.8.1'
developerId = 'leandroBorgesFerreira'
developerName = 'Leandro Borges Ferreira'
developerEmail = 'lehen01#gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
repositories {
mavenCentral()
}
// Place it at the end of the file
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
And this project gradle:
buildscript {
ext.kotlin_version = '1.0.4'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
But when I run:
./gradlew install
I get this error:
javadoc: error - Illegal package name: "/Users/hinovamobile/Desktop/Leandro/projetinhos/CurrentCenterPositionMap/mapfragmentwrapper/src/main/java/br/com/simplepass/mapfragmentwrapper/MapFragmentWrapper.kt"
1 error
:mapfragmentwrapper:javadoc FAILED
So what I am doing wrong? I'm not sure how to fix this error in the Javadoc...
Try using gradle-fury's scripts to generate javadoc. It does a different version for each android variant, supports umldocs via graphviz, the doc-html folder structure and more. For both Java and Android
Once the scripts are applied to your setup, make the javadocs via
gradlew install -Pprofile=javadoc
https://github.com/gradle-fury/gradle-fury
In your main gradle file, add the following lines:
tasks.withType(Javadoc).all {
enabled = false
}
Note: this will still normally show the javadocs when you press control + space on top of a class or method.
If you want to read more details check this link: https://github.com/novoda/bintray-release/issues/71
I get following error while running gradlew install.
Failed to capture snapshot of input files for task 'javadoc' during up-to-date check. See stacktrace for details.
Could not normalize path for file 'C:\android\sdk\platforms\android-23\android.jar;C:\android\sdk\platforms\android-23\optional\org.apache.http.legacy.jar'
The project's build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The library module's build.gradle:
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'com.github.dcendents.android-maven'
ext {
bintrayRepo = 'maven'
bintrayName = 'befrest'
publishedGroupId = 'com.oddrun.libraries'
libraryName = 'Befrest'
artifact = 'befrest'
libraryDescription = 'Simple Push Notification Library For Android'
siteUrl = 'https://github.com/hojjat-imani/PushNotif'
gitUrl = 'https://github.com/hojjat-imani/PushNotif.git'
libraryVersion = '0.0.1'
developerId = 'hojjat-imani'
developerName = 'Hojjat Imani'
developerEmail = 'imani.hojjat95#gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode 0
versionName "0.0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
}
version = libraryVersion
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
}
// Bintray
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
user = properties.getProperty("bintray.user")
key = properties.getProperty("bintray.apikey")
configurations = ['archives']
pkg {
repo = bintrayRepo
name = bintrayName
desc = libraryDescription
websiteUrl = siteUrl
vcsUrl = gitUrl
licenses = allLicenses
publish = true
publicDownloadNumbers = true
version {
desc = libraryDescription
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = properties.getProperty("bintray.gpg.password")
//Optional. The passphrase for GPG signing'
}
}
}
}
group = publishedGroupId // Maven Group ID for the artifact
install {
repositories.mavenInstaller {
// This generates POM.xml with proper parameters
pom {
project {
packaging 'aar'
groupId publishedGroupId
artifactId artifact
// Add your description here
name libraryName
description libraryDescription
url siteUrl
// Set your license
licenses {
license {
name licenseName
url licenseUrl
}
}
developers {
developer {
id developerId
name developerName
email developerEmail
}
}
scm {
connection gitUrl
developerConnection gitUrl
url siteUrl
}
}
}
}
}
You can add org.apache.http.legacy.jar in your libs folder.
You can find this jar in Android/Sdk/platforms/android-23/optional
I also added this line to my app.gradle file
compile files('libs/org.apache.http.legacy.jar')
But if you're using more libraries, you can use this way
compile fileTree(dir: 'libs', include: ['*.jar'])
This resolved all my errors that were caused because google removed support of Apache HTTP client. Do not changed compileSdkVersion 23 to 22, I think this solution is better.
There seems to be a problem with apache http in android 23.
Just changing compileSdkVersion 23 to 22 and removing useLibrary 'org.apache.http.legacy' solved the problem.
I'm trying to create a maven library using Android Studio and bintray but I can't get it working. When I try to upload the lib using gradle bintrayUpload I allways get the following error:
Could not upload to 'https://api.bintray.com/content/company/maven/company-simplename-lib/simplename/company-simplename-lib/lib/0.0.1/lib-0.0.1.pom': HTTP/1.1 400 Bad Request [message:Unable to upload files: Maven group, artifact or version defined in the pom file do not match the file path 'company-simplename-lib/lib/0.0.1/lib-0.0.1.pom']
This happens when I try to follow the example bintray has in their github repo.
I have changed my library build.gradle (not the root) to the following:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
plugins {
id "com.jfrog.bintray" version "1.4"
}
version = '0.0.1'
allprojects {
repositories {
jcenter()
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName '0.0.1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
}
install {
repositories.mavenInstaller {
pom.project {
name 'EasyGoogle'
description 'A wrapper library for basic functions of Google Play Services APIs'
url 'https://github.com/googlesamples/easygoogle'
inceptionYear '2015'
packaging 'aar'
groupId 'pub.devrel'
artifactId 'android-maven-example'
version '0.1'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
connection 'https://github.com/googlesamples/easygoogle.git'
url 'https://github.com/googlesamples/easygoogle'
}
developers {
developer {
name 'Google'
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
configurations = ['archives']
pkg {
repo = 'maven'
name = 'company-simplename-lib'
userOrg = user
licenses = ['Apache-2.0']
vcsUrl = 'http://example.com/android/company-simplename-lib.git'
version {
name = 'simplename'
desc = 'test build'
vcsTag = '0.0.1'
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}
Is someone able to see what I'm doing wrong? Becasue I can't and I can't find any good documentation about this either.
Please go through below blog , it clearly explain everything.
http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
If you still face issue of uploading pom file then make sure
libraryName , artifact and module name should be same.
I got it working by removing the install part from the gradle file so it looks like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
plugins {
id "com.jfrog.bintray" version "1.4"
}
version = '0.0.4'
allprojects {
repositories {
jcenter()
}
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName '0.0.4'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
configurations = ['archives']
pkg {
repo = 'maven'
name = 'company-simplename-lib'
userOrg = user
licenses = ['Apache-2.0']
vcsUrl = 'http://gitlab.company-servic.es/android/company-simplename-lib.git'
version {
name = 'simplename'
desc = 'test build'
vcsTag = '0.0.4'
attributes = ['gradle-plugin': 'com.use.less:com.use.less.gradle:gradle-useless-plugin']
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}
I want to upload a library to Maven/BinTray through gradle. After a long period of trial and error, I managed to upload it.
As you can see, the resulting package is "app" instead of "libraryName".
Here is my build.gradle (top level)
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Here is my build.gradle (app level):
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
}
ext {
bintrayRepo = 'maven'
bintrayName = [...]
publishedGroupId = [...]
libraryName = [...]
artifact = 'libraryName'
libraryDescription = [...]
siteUrl = [...]
gitUrl = [...]
libraryVersion = '1.0'
developerId = [...]
developerName = [...]
developerEmail = [...]
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
apply from: 'https://raw.githubusercontent.com/smasoumi/Bintray/master/install.gradle'
apply from: 'https://raw.githubusercontent.com/smasoumi/Bintray/master/bintray.gradle'
Here is my settings.gradle:
include ':app'
rootProject.name = 'libraryName'
Things I have tried:
Setting the rootProject.name ="..." as specified in the android-maven-gradle documentation. Did not work.
Adding "artifact" in the ext {} - Did not work.
Setting the artifact name same as rootProject.name. Did not work.
Has anyone encountered this problem and can help me? Thank you!