platform icon indicating copy to clipboard operation
platform copied to clipboard

Cannot use alpha versions of the Gradle plugin

Open mvysny opened this issue 4 years ago • 4 comments
trafficstars

When trying to use the 20.0.0.alpha7 version of the Gradle plugin (only available at http://tools.vaadin.com/nexus/content/repositories/vaadin-prereleases/com/vaadin/vaadin-gradle-plugin/ ) by using the following in build.gradle:

plugins {
  id 'com.vaadin' version '20.0.0.alpha7'
}

Gradle fails with:

FAILURE: Build failed with an exception.

* Where:
Build file '/home/mavi/work/my/vok/karibu10-helloworld-application/build.gradle.kts' line: 5

* What went wrong:
Plugin [id: 'com.vaadin', version: '20.0.0.alpha7'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.vaadin:com.vaadin.gradle.plugin:20.0.0.alpha7')
  Searched in the following repositories:
    maven(https://maven.vaadin.com/vaadin-prereleases)
    Gradle Central Plugin Repository

That leads me to believe that Gradle looks up the plugin with the com.vaadin.gradle.plugin artifact ID, while currently we publish the plugin as vaadin-gradle-plugin (the group ID seems to be correct).

Steps to reproduce

  1. git clone https://github.com/mvysny/karibu10-helloworld-application
  2. Check out the master branch
  3. Modify the plugin version to 20.0.0.alpha7
  4. Run ./gradlew

mvysny avatar Apr 13 '21 06:04 mvysny

The plugin from the pre-release repository needs to be defined as:

buildscript {
    dependencies {
        classpath group: 'com.vaadin',
                name: 'vaadin-gradle-plugin',
                version: '20.0.0.alpha7'
    }
}
plugins {
    id 'war'
    id 'org.gretty' version '3.0.3'
}

apply plugin: 'com.vaadin'

As described in the documentation: https://vaadin.com/docs/latest/guide/start/gradle/#pre-release

caalador avatar Apr 13 '21 06:04 caalador

Gotcha, that should work well. However, I think it would be a better dev UX if a pre-release versions of the plugin would work with exactly the same code snippet as the release plugin does:

plugins {
  id 'com.vaadin' version '20.0.0.alpha7'
}

That will allow the developer to upgrade to the newest release plugin version quickly.

mvysny avatar Apr 13 '21 06:04 mvysny

I don't think it possible as the plugins searches for com.vaadin:com.vaadin.gradle.plugin:20.0.0.alpha7 where as the pre-releases version is com.vaadin:vaadin-gradle-plugin:20.0.0.alpha7 I guess gradle plugin portal does some renaming on request?

At least I can't find any way of getting it to work by defining only a plugins.id

caalador avatar Apr 13 '21 08:04 caalador

I was thinking about renaming the Maven module from vaadin-gradle-pluginto com.vaadin.gradle.plugin - that should do the trick :+1:

mvysny avatar Apr 13 '21 09:04 mvysny