bintray:无法上传文件:pom文件中定义的Maven组、工件或版本不匹配
Posted
技术标签:
【中文标题】bintray:无法上传文件:pom文件中定义的Maven组、工件或版本不匹配【英文标题】:bintray: Unable to upload files: Maven group, artifact or version defined in the pom file do not match 【发布时间】:2016-02-13 13:48:35 【问题描述】:我正在尝试使用 android Studio 和 bintray 创建一个 maven 库,但无法正常工作。当我尝试使用gradle bintrayUpload
上传库时,我总是收到以下错误:
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']
当我尝试遵循 bintray 在其github repo 中的示例时会发生这种情况。
我已将我的库 build.gradle
(不是根)更改为以下内容:
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'
有人能看出我做错了吗?因为我不能,也找不到任何关于此的好的文档。
【问题讨论】:
【参考方案1】:请浏览下面的博客,它清楚地解释了一切。
http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
如果您仍然面临上传 pom 文件的问题,请确保 libraryName 、artifact 和模块名称应该相同。
【讨论】:
【参考方案2】:我通过从 gradle 文件中删除安装部分来使其工作,所以它看起来像这样:
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'
【讨论】:
如果没有install
标签,如何构建POM文件?
如果您的发布方法设置正确并且您不希望模块名称与您的 artifactId 相同,这是正确的以上是关于bintray:无法上传文件:pom文件中定义的Maven组、工件或版本不匹配的主要内容,如果未能解决你的问题,请参考以下文章
在 bintray 上上传二进制文件时 HTTP/1.1 401 未经授权
Android Gradle 插件将自定义 Gradle 插件上传到自建 Maven 仓库 ④ ( 默认生成的 pom 文件 | Maven 中的 pom 配置 | 自定义 pom 文件节点 )