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

Groovy 4 #326

Merged
merged 3 commits into from
Sep 6, 2024
Merged

Groovy 4 #326

merged 3 commits into from
Sep 6, 2024

Conversation

codeconsole
Copy link
Contributor

Remove large configurations block and set to groovy 4

@jamesfredley
Copy link
Contributor

@codeconsole The only holdup on Groovy 4 for the grails-gradle-plugin is:

https://docs.gradle.org/current/userguide/compatibility.html#groovy "Gradle plugins written in Groovy must use Groovy 3.x for compatibility with Gradle and Groovy DSL build scripts."

@jamesfredley
Copy link
Contributor

Groovy 4 appears to work and eliminates the Groovy 3 vs 4 conflicts nicely, I just wish there was confirmation that the statement from Gradle is no longer valid.

build.gradle Outdated Show resolved Hide resolved
@matrei
Copy link
Contributor

matrei commented Sep 5, 2024

Groovy 4 appears to work and eliminates the Groovy 3 vs 4 conflicts nicely, I just wish there was confirmation that the statement from Gradle is no longer valid.

@codeconsole Have you tried to use the plugins from this project compiled with Groovy 4?

build.gradle Outdated
}
}
}
configurations.all*.exclude group: 'org.apache.groovy', module: 'groovy-xml'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find It's better to use configurations.configureEach as configurations.all will configure all configurations eagerly (even unused configurations), while the former does so only lazily upon usage. I also like to write a comment as to why, I for example exclude something, because then it's really easy for the next developer reading the file to understand.

@jamesfredley
Copy link
Contributor

@puneetbehl submitted a PR with the Groovy 4 update, about 2 years ago, so this appears to have been planned for Grails 6, but Groovy 4 got bumped to Grails 7.

#139

@codeconsole
Copy link
Contributor Author

Groovy 4 appears to work and eliminates the Groovy 3 vs 4 conflicts nicely, I just wish there was confirmation that the statement from Gradle is no longer valid.

@codeconsole Have you tried to use the plugins from this project compiled with Groovy 4?

:compileGroovyPages works, but :urlMappingsReport fails

./gradlew :urlMappingsReport

> Task :urlMappingsReport FAILED
Context failed to load: Bean definition [io.micronaut.spring.context.factory.ImportBeanRegistrarProcessor] could not be loaded: Could not initialize class io.micronaut.inject.annotation.AnnotationMetadataSupport


@jamesfredley
Copy link
Contributor

jamesfredley commented Sep 5, 2024

I tested it against grails-database-migration and gorm-mongodb: assemble, build & groovydoc - no issues

and it allows removal of the following from buildScript:

configurations.configureEach {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            // This is a workaround for dependencies exposing a different version of Groovy
            // than the one used by Gradle. This causes issues with the Groovy compiler.
            if (details.requested.group == 'org.apache.groovy' || details.requested.group == 'org.codehaus.groovy') {
                details.useTarget(group: "org.codehaus.groovy", name: details.requested.name, version: GroovySystem.version)
                details.because "Use Groovy 3.0.x library shipped with Gradle"
            }
        }
    }

There are still some 7.0.0-SNAPSHOT dependencies that are referencing org.codehaus.groovy which separately need updated.

org.grails:grails-gsp:7.0.0-SNAPSHOT
org.grails:grails-web-gsp-taglib:7.0.0-SNAPSHOT
org.grails:grails-web-gsp:7.0.0-SNAPSHOT
org.grails:grails-web-jsp:7.0.0-SNAPSHOT

PR for these grails/grails-gsp#477

@jamesfredley
Copy link
Contributor

The following should resolve Context failed to load: Bean definition [io.micronaut.spring.context.factory.ImportBeanRegistrarProcessor] could not be loaded: Could not initialize class io.micronaut.inject.annotation.AnnotationMetadataSupport

"io.micronaut:micronaut-inject-groovy:$micronautVersion"
"io.micronaut:micronaut-inject:$micronautVersion"

@codeconsole codeconsole merged commit 00e6554 into grails:7.0.x Sep 6, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants