A maven-publish example to BinTray

(Mark Petrovic) #1

I started using the maven-publish plugin to publish maven artifacts. Works well.

Here is an example for posterity: https://gist.github.com/ae6rt/6241247

I did get hung up on one obscure issue, however. I publish to a remote repository on BinTray. This repository requires HTTP Basic Auth using a username and an API key. The API keys BinTray uses are rather long. It turns out that underlying JDK6 code that builds the Base64 encoded user:password for Basic Auth introduces a line break somewhere toward the end of the Base64 string, which cause damage to the header. So to get around this, you have to use JDK7 to publish your artifacts when the effective Basic Auth password (the API key) is long.

So I did invoke the gradle process to publish the artifact using JDK7, but that was not quite good enough. Invoking the gradle process with --no-daemon was sufficient however. Apparently I had a JDK6 daemon doing the actual publish work, so the publish still failed.

Hope this helps someone out there.