gradle - upload an eclipse android library project to maven central -


background have been building android library project in eclipse..it not built gradle , follows old android folder structure

now in order upload maven cental first made account @ sonatype , created issue @ jira new project . created repo groupid com.github.amansatija , (for had wait 2 business days until issue resolved )

now created gpg key pair ring

after exported eclipse android library project gradle imported in androistudio make sure has become gradle friendly .. after android library project's build system changed gradle followed chris banes maven-push gradle plugin on github deploy library project on maven

below details of gradle system

my global gradle.properties file (the 1 @ user_homer.gradle\gradle.properties) contains

nexus_username=amansatija nexus_password=mushroom@7  signing.keyid=16df7223 signing.password=customer360 signing.secretkeyringfile=mitul_private_key.gpg 

my project's gradle.properties conatins

version_name=0.0.1-snapshot version_code=1 group=com.github.amanasatija  pom_description=a demo test lib understand maven central uploads pom_url=https://github.com/amansatija/cus360mavencentraldemolib pom_scm_url=https://github.com/amansatija/cus360mavencentraldemolib pom_scm_connection==https://github.com/amansatija/cus360mavencentraldemolib.git pom_scm_dev_connection==https://github.com/amansatija/cus360mavencentraldemolib.git pom_licence_name=the apache software license, version 2.0 pom_licence_url=http://www.apache.org/licenses/license-2.0.txt pom_licence_dist=repo pom_developer_id=amansatija pom_developer_name=aman satija 

my project's maven_push file contains following

/*  * copyright 2013 chris banes  *  * licensed under apache license, version 2.0 (the "license");  * may not use file except in compliance license.  * may obtain copy of license @  *  *     http://www.apache.org/licenses/license-2.0  *  * unless required applicable law or agreed in writing, software  * distributed under license distributed on "as is" basis,  * without warranties or conditions of kind, either express or implied.  * see license specific language governing permissions ,  * limitations under license.  */  apply plugin: 'maven' apply plugin: 'signing'  def isreleasebuild() {     return version_name.contains("snapshot") == false }  def getreleaserepositoryurl() {     return hasproperty('release_repository_url') ? release_repository_url             : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" }  def getsnapshotrepositoryurl() {     return hasproperty('snapshot_repository_url') ? snapshot_repository_url             : "https://oss.sonatype.org/content/repositories/snapshots/" }  def getrepositoryusername() {     return hasproperty('nexus_username') ? nexus_username : "" }  def getrepositorypassword() { println(nexus_password) println(nexus_username)     return hasproperty('nexus_password') ? nexus_password : "" }  afterevaluate { project ->     uploadarchives {         repositories {             mavendeployer {                 beforedeployment { mavendeployment deployment -> signing.signpom(deployment) }                  pom.groupid = group                 pom.artifactid = pom_artifact_id                 pom.version = version_name                  repository(url: getreleaserepositoryurl()) {                     authentication(username: getrepositoryusername(), password: getrepositorypassword())                 }                 snapshotrepository(url: getsnapshotrepositoryurl()) {                     authentication(username: getrepositoryusername(), password: getrepositorypassword())                 }                  pom.project {                     name pom_name                     packaging pom_packaging                     description pom_description                     url pom_url                      scm {                         url pom_scm_url                         connection pom_scm_connection                         developerconnection pom_scm_dev_connection                     }                      licenses {                         license {                             name pom_licence_name                             url pom_licence_url                             distribution pom_licence_dist                         }                     }                      developers {                         developer {                             id pom_developer_id                             name pom_developer_name                         }                     }                 }             }         }     }      signing {          required { isreleasebuild() && gradle.taskgraph.hastask("uploadarchives") }         sign configurations.archives     }      task androidjavadocs(type: javadoc) {         source = android.sourcesets.main.java.srcdirs         classpath += project.files(android.getbootclasspath().join(file.pathseparator))     }      task androidjavadocsjar(type: jar, dependson: androidjavadocs) {         classifier = 'javadoc'         androidjavadocs.destinationdir     }      task androidsourcesjar(type: jar) {         classifier = 'sources'         android.sourcesets.main.java.sourcefiles     }      artifacts {         archives androidsourcesjar         archives androidjavadocsjar     } } 

as can see have print nexus username , password , script seems have found credentials

below lib module's build.gradle

    buildscript {         repositories {             mavencentral()         }         dependencies {             classpath 'com.android.tools.build:gradle:0.12.+'         }     }     apply plugin: 'com.android.library'      dependencies {         compile filetree(dir: 'libs', include: '*.jar')     }      android {         compilesdkversion 21         buildtoolsversion "21.0.1"          compileoptions {             sourcecompatibility javaversion.version_1_7             targetcompatibility javaversion.version_1_7         }          sourcesets {             main {                 manifest.srcfile 'androidmanifest.xml'                 java.srcdirs = ['src']                 resources.srcdirs = ['src']                 aidl.srcdirs = ['src']                 renderscript.srcdirs = ['src']                 res.srcdirs = ['res']                 assets.srcdirs = ['assets']             }              // move tests tests/java, tests/res, etc...             instrumenttest.setroot('tests')              // move build types build-types/<type>             // instance, build-types/debug/java, build-types/debug/androidmanifest.xml, ...             // moves them out of them default location under src/<type>/...             // conflict src/ being used main source set.             // adding new build types or product flavors should accompanied             // similar customization.             debug.setroot('build-types/debug')             release.setroot('build-types/release')         }     }  apply from: '../maven_push.gradle' 

also below library module's gradle.properties file

pom_name=demolibmavencentral pom_artifact_id=demolibmavencentral pom_packaging=aar 

as see have followed turoial appropriately when gradlew clean uploadarchives task ,, goes smoothly except last step says failed access denied

what went wrong:execution failed task ':demolibmanvencentral:uploadarchives'.could not publish configuration 'archives' error deploying artifact 'com.github.amanasatija:library:apk':  error deploying artifact: authorization failed: access denied to: https://oss.sonatype.org/content/repositories/snapshots/com/github/amanasatija/library/0.0.1-snapshot/library-0.0.1-20141114.123550-1.apk 

help me out ...please ...

edit

solution::

so managed solve issue. apparently problem

version_name=0.0.1-snapshot 

in project's gradle.properties file when changed above line following

version_name=0.0.1 

it worked seems have worked .. tag snapshot causing artifacts deployed snapshot repo of snotype , , snapshot repo reason apprently seems not wat artifacts , guess wants pics or snapshots of application

it looks don't have permissions publish artifacts com.github.amanasatija group id on server.

file issue @ https://issues.sonatype.org under "community support - open source project repository hosting" project , we'll sorted out.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -