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

Could not create package: HTTP/1.1 400 Bad Request > [message:License '[' does not exist] #98

Open
johnjohndoe opened this issue Nov 29, 2015 · 8 comments

Comments

@johnjohndoe
Copy link

I am trying to release the 1st version of the Overpass Java library I wrote. The release configuration can be found on this temporary branch.
When I run ./gradlew bintrayUpload this fails with following error:

Execution failed for task ':bintrayUpload'.

Could not create package 'tbsprs/maven/Overpass': HTTP/1.1 400 Bad Request > [message:License '[' does not exist]

I don't really understand the error message.
Here is what I get when I run ./gradlew bintrayUpload --debug:

[LIFECYCLE] [class org.gradle.TaskExecutionLogger] :bintrayUpload
[DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':bintrayUpload'
[DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Determining if task ':bintrayUpload' is up-to-date
[INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Executing task ':bintrayUpload' (up-to-date check took 0.0 secs) due to: Task has not declared any outputs.
[DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':bintrayUpload'.
[INFO] [org.gradle.api.Task] Found 0 configuration(s) to publish.
[DEBUG] [groovyx.net.http.HTTPBuilder] HEAD https://api.bintray.com/packages/tbsprs/maven/Overpass
[DEBUG] [org.apache.http.impl.conn.BasicClientConnectionManager] Get connection for route {s}->https://api.bintray.com
[DEBUG] [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to api.bintray.com:443
[DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: best-match
[DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
[DEBUG] [org.apache.http.client.protocol.RequestProxyAuthentication] Proxy auth state: UNCHALLENGED
[DEBUG] [org.apache.http.impl.client.DefaultHttpClient] Attempt 1 to execute request
[DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: HEAD /packages/tbsprs/maven/Overpass HTTP/1.1
[DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 404 Not Found
[DEBUG] [org.apache.http.impl.conn.BasicClientConnectionManager] Releasing connection org.apache.http.impl.conn.ManagedClientConnectionImpl@2380c601
[DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection 0.0.0.0:53070<->108.168.194.90:443 shut down
[DEBUG] [groovyx.net.http.HTTPBuilder] Response code: 404; found handler: com.jfrog.bintray.gradle.BintrayUploadTask$_bintrayUpload_closure5_closure21_closure24@21e903e1
[INFO] [org.gradle.api.Task] Package 'Overpass' does not exist. Attempting to creating it...
[DEBUG] [groovyx.net.http.HTTPBuilder] POST https://api.bintray.com/packages/tbsprs/maven
[DEBUG] [org.apache.http.impl.conn.BasicClientConnectionManager] Get connection for route {s}->https://api.bintray.com
[DEBUG] [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to api.bintray.com:443
[DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: best-match
[DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
[DEBUG] [org.apache.http.client.protocol.RequestProxyAuthentication] Proxy auth state: UNCHALLENGED
[DEBUG] [org.apache.http.impl.client.DefaultHttpClient] Attempt 1 to execute request
[DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: POST /packages/tbsprs/maven HTTP/1.1
[DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 400 Bad Request
[DEBUG] [org.apache.http.impl.client.DefaultHttpClient] Connection can be kept alive indefinitely
[DEBUG] [groovyx.net.http.HTTPBuilder] Response code: 400; found handler: com.jfrog.bintray.gradle.BintrayUploadTask$_bintrayUpload_closure5_closure22_closure26@3226a780
[DEBUG] [groovyx.net.http.HTTPBuilder] Parsing response as: application/json
[DEBUG] [groovyx.net.http.ParserRegistry] Could not find charset in response; using UTF-8
[DEBUG] [org.apache.http.impl.conn.BasicClientConnectionManager] Releasing connection org.apache.http.impl.conn.ManagedClientConnectionImpl@79eb3322
[DEBUG] [org.apache.http.impl.conn.BasicClientConnectionManager] Connection can be kept alive indefinitely
[DEBUG] [groovyx.net.http.HTTPBuilder] Parsed data to instance of: class groovy.json.internal.LazyMap
[DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':bintrayUpload'

[LIFECYCLE] [class org.gradle.TaskExecutionLogger] :bintrayUpload FAILED
[INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :bintrayUpload (Thread[Task worker,5,main]) completed. Took 3.745 secs.
[DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Task worker,5,main]] finished, busy: 3.823 secs, idle: 2.169 secs
[ERROR] [org.gradle.BuildExceptionReporter]
[ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
[ERROR] [org.gradle.BuildExceptionReporter]
[ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
[ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':bintrayUpload'.
[ERROR] [org.gradle.BuildExceptionReporter] > Could not create package 'tbsprs/maven/Overpass': HTTP/1.1 400 Bad Request [message:License '[' does not exist]
[ERROR] [org.gradle.BuildExceptionReporter]
[ERROR] [org.gradle.BuildExceptionReporter] * Try:
[ERROR] [org.gradle.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.
[LIFECYCLE] [org.gradle.BuildResultLogger]
[LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED
[LIFECYCLE] [org.gradle.BuildResultLogger]
[LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 16.764 secs

Can I actually create the first release just via the plugin or do I have to manually do something on the Bintray website before? Please have look at my deployment configuration to spot errors.

@johnjohndoe
Copy link
Author

I managed to release the library by temporarily replacing:

licenses = project.packageLicenses

with

licenses = ['Apache-2.0']

Note that I use gradle.properties to maintain these values in one place.
Please check if this behavior is reproducible bug.

@eyalbe4
Copy link
Contributor

eyalbe4 commented Dec 2, 2015

Hey @johnjohndoe ,
Please let me know if this makes sense:
The licenses value is a list. For example, ['Apache-2.0'] is a list with one element. Could it be that the property you're reading from gradle.properties is a string and that's what causes the issue?
If so, you can try to do something like this:

def configuredLicenses = [lic1, lic2, lic3]

while saving lic1, lic2 and lic3 as 3 different properties in your gradle.properties

@johnjohndoe
Copy link
Author

My gradle.properties contains the following definition:

packageLicenses=['Apache-2.0']

Do you know if a properties file can actually deal with other then strings?

@eyalbe4
Copy link
Contributor

eyalbe4 commented Dec 3, 2015

I'm not aware of any Gradle or Groovy implementation that does that, but you can probably create your own simple implementation that takes a property string value, splits it according to a delimiter and returns a list.

@johnjohndoe
Copy link
Author

So, if I understand correctly this is kind of an issue then with the plugin since most developers will not hard code settings within the deployment script but instead use a separate file such as gradle.properties. How do we deal with this in a smart way?

@eyalbe4
Copy link
Contributor

eyalbe4 commented Dec 3, 2015

As always, we welcome ideas, suggestions and code contributions from the community.

@johnjohndoe
Copy link
Author

First of all, you should throw an exception when you detect an invalid property value such as an Array. This error message should clearly state the problem (which is not the case in the error message in my initial post) so that developers know how to deal with it. As a follow up one might come up with a handy solution for defining an Array value in a properties file.

@drorb
Copy link

drorb commented Dec 15, 2015

The gradle.properties file is a regular Java properties file and as such it cannot hold keys with multiple values.
A simple solution would be having a comma delimited string in the properties file, for example:

licenses=Apache-2.0,BSD

And splitting this value in build.gradle to create an array

licenses = project.property('licenses').split(',')

JustinTullgren pushed a commit to thunderheadone/one-android-gradle-aspectj that referenced this issue Oct 18, 2018
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

3 participants