Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

400 exception with failed upload of POM file only? #88

Open
reaperdtme opened this issue Sep 14, 2015 · 26 comments
Open

400 exception with failed upload of POM file only? #88

reaperdtme opened this issue Sep 14, 2015 · 26 comments

Comments

@reaperdtme
Copy link

build.grade

apply plugin: 'com.android.library'

ext {
    bintrayRepo = 'maven'
    bintrayName = 'appswitcher'
    bintrayOrg = 'inmarket'
    versionName = "1.0.0"

    publishedGroupId = 'com.inmarket'
    libraryName = 'appswitcher'
    artifact = 'appswitcher'

    libraryDescription = 'App switching library for Android'

    libraryVersion = '1.0.0'

    developerId = 'zaidd'
    developerName = 'Zaid Daghestani'
    developerEmail = 'zdaghestani@inmarket.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 21
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 8
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile "com.android.support:support-v4:18.0.+"
}

//bintray init

apply plugin: 'com.github.dcendents.android-maven'

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

                // Set your license
                licenses {
                    license {
                        name licenseName
                        url licenseUrl
                    }
                }
                developers {
                    developer {
                        id developerId
                        name developerName
                        email developerEmail
                    }
                }
            }
        }
    }
}

// bintray do

apply plugin: 'com.jfrog.bintray'

version = libraryVersion

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

task javadoc(type: Javadoc) {
    description "app javadocs"
    source = android.libraryVariants["release"].javaCompile.source
    ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
    classpath = files(android.libraryVariants["release"].javaCompile.classpath.files) + files(ext.androidJar)
    options.links("http://docs.oracle.com/javase/7/docs/api/");
    options.links("http://d.android.com/reference/");
    exclude '**/BuildConfig.java'
    exclude '**/R.java'
}

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
        userOrg = bintrayOrg
        desc = libraryDescription
        licenses = allLicenses
        publish = true
        publicDownloadNumbers = true
        version {
            name = bintrayName
            desc = libraryDescription
        }
    }
}

generated pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.inmarket</groupId>
  <artifactId>appswitcher</artifactId>
  <version>1.0.0</version>
  <packaging>aar</packaging>
  <name>appswitcher</name>
  <description>App switching library for Android</description>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>zaidd</id>
      <name>Zaid Daghestani</name>
      <email>zdaghestani@inmarket.com</email>
    </developer>
  </developers>
  <dependencies>
    <dependency>
      <groupId>com.android.support</groupId>
      <artifactId>support-v4</artifactId>
      <version>18.0.+</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

@eyalbe4
Copy link
Contributor

eyalbe4 commented Oct 20, 2015

@zaiddag, see my comment for this issue.
I think both issues talk about the same thing.

@skavinvarnan
Copy link

@zaiddag have you found a solution for this?

@reaperdtme
Copy link
Author

@skavinvarnan deleted the package entirely, after some time, it'll start working again. Not sure why or how "some time", but it doesn't work right away. >.<

@skavinvarnan
Copy link

@zaiddag i finally found the problem. you project name (library name) and the artifactId should be same. But this was my case.

@LeebeeDev
Copy link

@skavinvarnan thank you, you made my day

@Batzee
Copy link

Batzee commented Apr 20, 2016

@skavinvarnan your trick worked :D

@eyalbe4
Copy link
Contributor

eyalbe4 commented Apr 20, 2016

According to the feedback in #81 release 1.6 resolves this issue.
Please let us know what you think.

@adil-hussain-84
Copy link

Nope. I still get this issue in release 1.6.

@chRyNaN
Copy link

chRyNaN commented May 9, 2016

To build upon @skavinvarnan answer, make sure that your module name is also in sync with the artifact and libraryName fields.

@adil-hussain-84
Copy link

@chRyNaN: I got it working in the end. I have a project that consists of a single module (an Android library). In the build.gradle file of the Android module I found I had to specify the group and version doubly as follows to not get the 400 exception:

plugins {
    id 'com.jfrog.bintray' version '1.6'
}

apply plugin: 'maven-publish'
apply plugin: 'com.android.library'

group = "${myGroupName}"
version = "${myVersionName}"

publishing {
    publications {
        MySDK(MavenPublication) {
            groupId "${myGroupName}"
            version "${myVersionName}"
        }
    }
}

@eyalbe4
Copy link
Contributor

eyalbe4 commented May 10, 2016

Thanks for sharing this @adil-hussain-84 !
Will you be able to contribute an Android Gradle project example that uses the Bintray Plugin? Thsi could help others in troubleshooting such issues. We can place the example here.

@adil-hussain-84
Copy link

adil-hussain-84 commented May 14, 2016

@eyalbe4 Sure. Good idea. I'll put together a small standalone example that demonstrates using the maven-publish plugin together with the com.jfrog.bintray plugin when I get a moment. In the meanwhile, anyone who stumbles across this thread can refer to the build.gradle and Android/build.gradle files in the following repository which publishes an Android library to Bintray:

https://bitbucket.org/adilson05uk/quran-sdk/src

@KadamMangesh
Copy link

@adil-hussain-84 - does your library also sync with maven central ?

@adil-hussain-84
Copy link

@MangeshKadam The Bintray publication of the library is linked to jcenter. The linking is done via the Bintray web interface.

@easternHong
Copy link

my case ,l forget this line:

group = publishedGroupId

@stanmots
Copy link

stanmots commented Feb 21, 2017

Solution given by @skavinvarnan still works (I spent a couple of hours trying to figure out what was causing this error)

@ramiloif
Copy link

@skavinvarnan May God bless you

@braj24
Copy link

braj24 commented Apr 6, 2017

bintrayRepo = 'Your Repo name"'
bintrayName = 'Package name'
publishedGroupId = 'YOUR GROUP ID'
libraryName = 'testlibrary'
artifact = 'testlibrary'
libraryname and artifact must be same. and also it should match with your library name which was given at the time of creation of Module.

@rafaelje
Copy link

This solution work for me, upgrade from 1.4 to 1.6:

  • classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
  • classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'

@rickenwang
Copy link

@rafaelje that's a perfect answer.

@hanggrian
Copy link

I'm having the same issue with 1.7.2, but upgrading to 1.8.1 fixes the problem.

@debuglevel
Copy link

@hendraanggrian Thank you. For me, it worked with version 1.7 some weeks ago, but stopped recently. Updating to version 1.8 solved the problem.

@jplaisted
Copy link

jplaisted commented Oct 12, 2020

Sorry for the 2+ year bump, but I'm having this issue on the latest version (1.8.5). It looks to me like this could be because I have non-top level modules. e.g. my project may look like

api/
    build.gradle
impl/
    ebean/
        build.gradle
    neo4j/
        build.gradle
build.gradle

Here api is a top level module and ebean and neo4j aren't (they are in the impl directory). If I try to use this plugin with this project structure the gradle task will fail stating that the ebean and neo4j projects had a 400 uploading the pom file, as described in the OP.

Since the top level modules (I have more than one) don't report this error, I assume this is an issue with non top level modules.


EDIT

FWIW I made this task for debugging

task dbg() {
  doFirst {
    println 'project name: ' + project.name
    configurations.archives.allArtifacts.each {
      println 'artifact: ' + it.name + ': ' + it.file.name
    }
  }
}

And here's some example output

> Task :dao-impl:ebean-dao:dbg
project name: ebean-dao
artifact: ebean-dao: ebean-dao-0.0.0.jar
artifact: ebean-dao: ebean-dao-0.0.0-sources.jar
artifact: ebean-dao: ebean-dao-0.0.0-javadoc.jar

So the gradle project name "lines up" with the jar name...


Edit 2:

Nope, moved them out, same error. Not sure why, it's only on those modules. The POM looks right and everything.

  <groupId>com.linkedin.datahub-gma</groupId>
  <artifactId>ebean-dao</artifactId>
  <version>0.0.0</version>

The only difference between this an another "working" pom file is the artifact ID and dependency list, both of which make sense.

Execution failed for task ':ebean-dao:bintrayUpload'.
> Could not upload to 'https://api.bintray.com/content/linkedin/maven/datahub-gma/0.0.0/com/linkedin/datahub-gma/ebean-dao/0.0.0/ebean-dao-0.0.0.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 'com/linkedin/datahub-gma/ebean-dao/0.0.0/ebean-dao-0.0.0.pom']

@jplaisted
Copy link

Seems to be something else unrelated to gradle since the POM fails to upload via the UI as well. I'll see if I can reach out to jfrog support.

@daniel-schel
Copy link

I had the same issue with maven, perhaps it helps you. The solution was to set the version tag explicitly at the maven modules I want to upload.

@jplaisted
Copy link

To update my issue, seems unrelated entirely. I don't know why, but I can only reproduce this when trying to publish version 0.0.0. Bumping up to any other version works fine.

Not an issue with the plugin, but the server. If this is intentional then at the very least the error message is very unclear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests