2014-11-14 2 views
1

배경을 받는다는하는 일식 안드로이드 라이브러리 프로젝트를 업로드 그것은 maven 중심으로 처음으로 sonatype에서 계정을 만들었고 jira에서 새 프로젝트를위한 문제를 만들었습니다. 그들은 내가 업로드하기 위해 이제 기존의 안드로이드 폴더 구조</p> <p>을 원래 Gradle을 사용하여 빌드되지 않습니다 eclipse..it의 안드로이드 라이브러리 프로젝트를 구축하고 다음 한 중앙

가 지금은 내가 이클립스 안드로이드를 수출

후 GPG 키 쌍 반지를 만들어 (내가 문제가 해결 될 때까지 업무 일 기준 2 일을 기다려야했다있는) 내 그룹 ID com.github.amansatija에 대한 REPO를 생성 라이브러리 프로젝트 다음 androistudio 그냥 완전히 gradle 친절한되고 있는지 확인하기 위해 가져 왔습니다. 지금은 안드로이드 라이브러리 프로젝트의 빌드 시스템을 다시 gradle로 변경 후 chris banes maven-push gradb 플러그인을 github에 배치합니다. Maven의 도서관 프로젝트

는 다음과 같습니다. gradle my system

내 글로벌 gradle.properties 파일 (user_homer.gradle \ gradle.properties의 하나) 이

VERSION_NAME=0.0.1-SNAPSHOT 
VERSION_CODE=1 
GROUP=com.github.amanasatija 

POM_DESCRIPTION=A demo test lib to 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 

내 프로젝트의 maven_push을이

NEXUS_USERNAME=amansatija 
[email protected] 

signing.keyId=16DF7223 
signing.password=customer360 
signing.secretKeyRingFile=mitul_private_key.gpg 

내 프로젝트의 gradle.properties의 conatins을 포함 파일에 다음이 포함되어 있습니다.

/* 
* Copyright 2013 Chris Banes 
* 
* Licensed under the Apache License, Version 2.0 (the "License"); 
* you may not use this file except in compliance with the License. 
* You may obtain a copy of the License at 
* 
*  http://www.apache.org/licenses/LICENSE-2.0 
* 
* Unless required by applicable law or agreed to in writing, software 
* distributed under the License is distributed on an "AS IS" BASIS, 
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
* See the License for the specific language governing permissions and 
* limitations under the 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' 
     from androidJavadocs.destinationDir 
    } 

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

    artifacts { 
     archives androidSourcesJar 
     archives androidJavadocsJar 
    } 
} 
당신이 볼 수

로 내가 그것을 넥서스 사용자 이름과 암호를 인쇄해야하고 스크립트가 자격 증명 아래

제대로

을 찾을 것으로 보인다 내 LIB 모듈의 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 the tests to tests/java, tests/res, etc... 
      instrumentTest.setRoot('tests') 

      // Move the build types to build-types/<type> 
      // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... 
      // This moves them out of them default location under src/<type>/... which would 
      // conflict with src/ being used by the main source set. 
      // Adding new build types or product flavors should be accompanied 
      // by a similar customization. 
      debug.setRoot('build-types/debug') 
      release.setRoot('build-types/release') 
     } 
    } 

apply from: '../maven_push.gradle' 

또한 아래에있는 내 라이브러리 모듈의 Gradle을하다 당신은 내가 turoial을 따라 보는 바와 같이 .properties의 내가 깨끗한 uploadArchives 작업을 gradlew 할 때 적절하게 그러나 ,, 모든 FO 제외하고 원활하게 진행

POM_NAME=DemoLibMavenCentral 
POM_ARTIFACT_ID=DemoLibMavenCentral 
POM_PACKAGING=aar 

파일 R은 액세스 실패 말한다 마지막 단계는 편집 ... 나를 도와

What went wrong:Execution failed for 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 

주세요 거부

솔루션 : 그래서

I 마침내이 문제를 해결할 수있었습니다. 은 분명히 문제는 내 프로젝트의 Gradle을에서

VERSION_NAME=0.0.1-SNAPSHOT 

했다.내가이 일을 다음

VERSION_NAME=0.0.1 

에 위의 라인을 변경하는 경우 속성 을 제기하는 것은 제대로 일한 것 같다 .. 태그 스냅 내 유물을 일으키는 원인이되었다 snotype의 REPO 스냅 샷 배포 및 스냅 샷의 repo에 대한 수 약간의 이유는 현명하게도 아티팩트를 보지 못하는 것처럼 보입니다. 응용 프로그램의 사진이나 스냅 샷을 원한다고 생각합니다.

답변

0

서버의 com.github.amanasatija 그룹 ID에 대한 이슈를 게시 할 수있는 권한이없는 것 같습니다 .

"Community Support - Open Source Project Repository Hosting"프로젝트의 https://issues.sonatype.org에서 문제를 제기하십시오. 우리는이 문제를 해결할 수 있도록 도와 드리겠습니다.

+0

나는 sonatype suppor 권한을 확인 Aksed, 그는 액세스가 잘못된 매개 변수가 전달되면 거부 된 말합니다 .. 왜 내가 볼 수없는 잘못된 매개 변수를 하나만 제외하고 shoudl 볼 때 내가 볼 폴더를 빌드 APK와 no arr file 제발 도와주세요. –