Plugin resolution service returned HTTP 400 with message 'Plugin ID 'com.github.rafael-brandao.scalabuff_2.10' contains invalid chars: '_'

I wrote the scalabuff-gradle-plugin to convert protocolbuf files in idiomatic Scala code using the ScalaBuff tool.

The plugin has to be compatible with scala versions 2.10 and 2.11, so in fact there are two plugins published in the Gradle Plugin Portal:

. com.github.rafael-brandao.scalabuff_2.10

. com.github.rafael-brandao.scalabuff_2.11

Using the new Gradle 2.1 plugin syntax as:

plugins {
  id "com.github.rafael-brandao.scalabuff_2.10" version "0.0.1"
}

gives me an error

Plugin resolution service returned HTTP 400 with message ‘Plugin ID ‘com.github.rafael-brandao.scalabuff_2.10’ contains invalid chars: ‘_’’ (url: https://plugins.gradle.org/api/gradle/2.1/plugin/use/com.github.rafael-brandao.scalabuff_2.10/0.0.1)

Using the regular buildscript code block works fine.

Looks like the error message is pretty self-explanatory.

Plugin IDs may only contain ASCII alphanumerics, ‘.’ and ‘-’

I’d probably just replace the underscore with a hyphen and call it a day. That being said, the instructions for publishing a plugin, located here should probably be updated to reflect this.

This was actually a bug in 2.1. The soon to be released 2.2 will allow you to use this plugin.

You can use a nightly snapshot in the meantime.

Apologies for the inconvenience.

Should this be interpreted as there being no character limitations for plugin ids in 2.2?

No, there are still limitations. However, they are sync’d between the two systems. So you can’t have a plugin in the portal that violates the constraints.

It is a common practice to publish scala libraries maven artifacts followed by the scala major version used. This is a very specific purpose plugin that generates scala code.

I managed to maintain a single code base to publish this plugin for scala 2.10 and 2.11. But compared to sbt, gradle support for cross scala compilation is still in it’s first steps to allow me to strip the scala version part of this plugin ID.