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

org.grails.grails-web & org.grails.grails-gsp Gradle Plugin ids with versions not working for snapshots #351

Open
jamesfredley opened this issue Nov 10, 2024 · 6 comments

Comments

@jamesfredley
Copy link
Contributor

org.grails.grails-web & org.grails.grails-gsp Gradle Plugin ids work with 6.2.1, but not with 6.2.2-SNAPSHOT. We must be missing something when we publish the grails-gradle-plugin snapshots to repo.grails.org.

The workaround is to use:

apply plugin: 'org.grails.grails-web'
apply plugin: 'org.grails.grails-gsp'

which does allow the project to load and gradle downloads the following files. Only the jar file has a definition for these ids. Removing the version does to resolve the issue.

Download https://repo.grails.org/grails/core/org/grails/grails-gradle-plugin/6.2.2-SNAPSHOT/maven-metadata.xml, took 1 s 522 ms
Download https://repo.grails.org/grails/core/org/grails/grails-gradle-plugin/6.2.2-SNAPSHOT/grails-gradle-plugin-6.2.2-20241107.044227-3.pom, took 46 ms
Download https://repo.grails.org/grails/core/org/grails/grails-gradle-plugin/6.2.2-SNAPSHOT/grails-gradle-plugin-6.2.2-20241107.044227-3.module, took 51 ms
Download https://repo.grails.org/grails/core/org/grails/grails-gradle-plugin/6.2.2-SNAPSHOT/grails-gradle-plugin-6.2.2-20241107.044227-3.jar, took 301 ms

6.2.1 works fine

buildscript {
    repositories {
        maven { url "https://repo.grails.org/grails/core" }
        mavenCentral()
    }
    dependencies { // Not Published to Gradle Plugin Portal
        classpath "org.grails:grails-gradle-plugin:6.2.1"
    }
}
plugins {
    id "groovy"
    id "org.grails.grails-web" version "6.2.1"
    id "org.grails.grails-gsp" version "6.2.1"
    id "com.github.erdi.webdriver-binaries" version "3.2"
    id "war"
    id "idea"
    id "com.bertramlabs.asset-pipeline" version "4.3.0"
    id "application"
    id "eclipse"
}

6.2.2-SNAPSHOT fails

buildscript {
    repositories {
        maven { url "https://repo.grails.org/grails/core" }
        mavenCentral()
    }
    dependencies { // Not Published to Gradle Plugin Portal
        classpath "org.grails:grails-gradle-plugin:6.2.2-SNAPSHOT"
    }
}
plugins {
    id "groovy"
    id "org.grails.grails-web" version "6.2.2-SNAPSHOT"
    id "org.grails.grails-gsp" version "6.2.2-SNAPSHOT"
    id "com.github.erdi.webdriver-binaries" version "3.2"
    id "war"
    id "idea"
    id "com.bertramlabs.asset-pipeline" version "4.3.0"
    id "application"
    id "eclipse"
}
Plugin [id: 'org.grails.grails-web', version: '6.2.2-SNAPSHOT'] was not found in any of the following sources:

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.grails.grails-web', version: '6.2.2-SNAPSHOT'] 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 'org.grails.grails-web:org.grails.grails-web.gradle.plugin:6.2.2-SNAPSHOT')
  Searched in the following repositories:
    Gradle Central Plugin Repository

These plugins are not published to the Gradle Central Plugin Repository

https://plugins.gradle.org/search?term=org.grails.grails-web
https://plugins.gradle.org/search?term=org.grails.grails-gsp
https://plugins.gradle.org/search?term=grails-gradle-plugin

@jamesfredley
Copy link
Contributor Author

These gradle plugins will load by version number if placed in settings.gradle, which downloads the pom file from the directories above, and can then be references by id in build.gradle, since they have already been loaded by settings.gradle. The version number cannot be repeated in build.gradle.

settings.gradle

pluginManagement {
    repositories {
        maven { url "https://repo.grails.org/grails/core/" }
    }
    plugins {
        id "org.grails.grails-web" version "6.2.2-SNAPSHOT"
        id "org.grails.grails-gsp" version "6.2.2-SNAPSHOT"
    }
}

build.gradle

plugins {
        id "groovy"
        id "org.grails.grails-gsp"
        id "org.grails.grails-web"
        id "war"
        id "idea"
        id "com.bertramlabs.asset-pipeline" version "5.0.1"
        id "application"
        id "eclipse"
}

@codeconsole
Copy link
Contributor

codeconsole commented Nov 10, 2024

This works as designed. It uses the version of grails-gradle-plugin that is in the class path because they are resolved from within that jar. You would never have a different version of the plugins.

This will be fixed when we break up and publish the plugins independently.

See #340

@jamesfredley
Copy link
Contributor Author

But why does a release version work with id and version and a snapshot fails with id or id and version? See full example in first comment.

works with classpath "org.grails:grails-gradle-plugin:6.2.1"

    id "org.grails.grails-web" version "6.2.1"
    id "org.grails.grails-gsp" version "6.2.1"

fails with classpath "org.grails:grails-gradle-plugin:6.2.2-SNAPSHOT"

    id "org.grails.grails-web" version "6.2.2-SNAPSHOT"
    id "org.grails.grails-gsp" version "6.2.2-SNAPSHOT"

fails with classpath "org.grails:grails-gradle-plugin:6.2.2-SNAPSHOT"

    id "org.grails.grails-web"
    id "org.grails.grails-gsp"

@codeconsole
Copy link
Contributor

perhaps because gradle plugins don't support snapshots?

why are you setting the version in settings.gradle?

@jamesfredley
Copy link
Contributor Author

The main example at the top does not use settings.gradle or buildSrc. There is an example lower down with settings.gradle, to show the different behavior.

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

2 participants