Publish plugin error

I’m trying to publish my plugin with gradle’s publishing plugin (com.gradle.plugin-publish), but I’m getting a rather inscrutable error when invoking the publishPlugins target:

Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
    at com.gradle.publish.LoginTask.loadProperties(
    at com.gradle.publish.PublishTask.buildOAuthClient(
    at com.gradle.publish.PublishTask.doSignedPost(
    at com.gradle.publish.PublishTask.publishToPortal(
    at com.gradle.publish.PublishTask.publish(
    at org.gradle.internal.reflect.JavaMethod.invoke(
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(
    ... 60 more

The build.gradle is here.

Hi Aaron

This looks like a bug in a component that we’re using in the publishing plugin. We’ll investigate a solution and get back to you.



@paleozogt Which version of gradle are you using and what operating system are you running on? I suspect that this may be something specific to the properties files on your environment. Do you have a properties file at ~/.gradle/ and if you do, could you share it (if it’s not sensitive) or try removing properties from that file to see if it makes any difference.

One scenario which causes this is a properties file with duplicates and one of those duplicates appears at the top of a properties file i.e. the properties file does not begin with a comment or a new line.



I added a newline to the top of my ~/.gradle/ file and that fixed it right up. I would have never guessed that was the issue.

This has been fixed in version 0.9.3