2015-11-12 8 views
9

Próbuję utworzyć bibliotekę maven przy użyciu Android Studio i bintray, ale nie mogę jej uruchomić. Kiedy próbuję przesłać lib przy użyciu gradle bintrayUpload I zawsze dobrze się następujący błąd:bintray: Nie można załadować plików: grupa Maven, artefakt lub wersja zdefiniowana w pliku pom nie pasują do

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'] 

Dzieje się tak, gdy próbuję naśladować przykład bintray ma w swojej github repo.

zmieniłem moją bibliotekę build.gradle (nie root) do następujących:

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' 
} 

Czy ktoś mógł zobaczyć, co robię źle? Becasue Nie mogę i nie mogę znaleźć żadnej dobrej dokumentacji na ten temat.

Odpowiedz

4

mam to działa poprzez usunięcie części instalacji z pliku Gradle więc wygląda to tak:

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' 
} 
+2

Jak utworzyć plik POM, jeśli nie masz tagu 'install'? – milosmns

+0

Jest to poprawne, jeśli masz poprawnie skonfigurowane metody publikowania i nie chcesz, aby nazwa twojego modułu była taka sama jak twój identyfikator artefaktu – HaydenKai

Powiązane problemy