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

Grails 6 Completely Overcomplicated create-app build Environment #347

Open
codeconsole opened this issue Aug 2, 2024 · 8 comments · May be fixed by #424
Open

Grails 6 Completely Overcomplicated create-app build Environment #347

codeconsole opened this issue Aug 2, 2024 · 8 comments · May be fixed by #424

Comments

@codeconsole
Copy link
Contributor

Grails 5.3.2 single file build.gradle
settings.gradle 1 line of code

became:

Grails 6.2
build.gradle
settings.gradle 16 lines of code
buildSrc/build.gradle

Dependencies went to

dependencies {
    implementation "org.springframework.boot:spring-boot-starter-logging"
    implementation "org.springframework.boot:spring-boot-starter-validation"
    implementation "org.springframework.boot:spring-boot-autoconfigure"
    implementation "org.grails:grails-core"
//  ...
dependencies {
    implementation("org.grails:grails-core")
    implementation("org.grails:grails-logging")
    implementation("org.grails:grails-plugin-databinding")
//  ...

Why are the parenthesis added? Katlin/Groovy hybrid? Formatting should remain consistent and representative of the languoge.

I am fine with build dependencies in buildSrc/build.gradle if that is the new convention, but why is it necessary for settings.gradle?
Are dependencies needed in 3 different locations? if so, why not just go back to buildscript {}

grails create-app should be as simple as possible. Having an overcomplicated build environment will scare away new developers who are not gradle experts.

Why historically so many dependencies?

grails-plugin-interceptors depends on grails-plugin-url-mappings depends on grails-plugin-controllers depends on grails-core and a lot of other stuff.

so why have grails-plugin-url-mappings, grails-plugin-controllers, grails-core listed redundantly if they are already going to be resolved?

@jamesfredley
Copy link
Contributor

jamesfredley commented Aug 2, 2024

Since create-app generates a single-project build, the settings.gradle file is optional. Separately from this, I'd love to work on a create-app-multi-project command to generate a multi-project build.

buildSrc has independent dependency version resolution and this makes managing security more complex by either adjusting versions and dependencySubstitutions in two locations or trying to configure includes that will work in both locations which can have overlapping dependencies.

https://docs.gradle.org/7.6.2/userguide/plugins.html#sec:plugin_markers - support for local custom Gradle plugins in build.gradle

buildScript is still supported in Gradle 8.9

For a Grails single-project build, buildSrc and settings.gradle can be consolidated into:

build.gradle

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        maven { url "https://plugins.gradle.org/m2/" }
        maven { url "https://repo.grails.org/grails/core" }
    }
    dependencies { // Not Published to Gradle Plugin Portal
        classpath("org.grails:grails-gradle-plugin:$grailsGradlePluginVersion")
        classpath("org.grails.plugins:hibernate5:$grailsPluginsHibernate5Version")
    }
}

plugins {
    // Published to Gradle Plugin Portal
    id "groovy"
    id "com.github.erdi.webdriver-binaries" version "3.2"
    id "war"
    id "idea"
    id "com.bertramlabs.asset-pipeline" version "$assetPipelineVersion"
    id "application"
    id "eclipse"

    // Not Published to Gradle Plugin Portal
    id "org.grails.grails-web" version "$grailsGradleWebGSPPluginVersion"
    id "org.grails.grails-gsp" version "$grailsGradleWebGSPPluginVersion"
}

repositories {
    mavenCentral()
    maven { url "https://repo.grails.org/grails/core/" }
}

// the rest of your build

with gradle.properties

grailsVersion=6.2.0
grailsGradlePluginVersion=6.1.2
version=0.1
org.gradle.caching=true
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xmx1024M
assetPipelineVersion=4.5.1
grailsPluginsHibernate5Version=8.1.0
grailsGradleWebGSPPluginVersion=6.2.0

@codeconsole
Copy link
Contributor Author

@jamesfredley what about upcoming gradle 9 compatablility?

@jamesfredley
Copy link
Contributor

@codeconsole I could not find anything on 9 in github, but 8.10 snapshots are coming from master and the plugin documentation is the same.

https://github.com/gradle/gradle/blob/master/platforms/documentation/docs/src/docs/userguide/authoring-builds/basics/plugins.adoc

@codeconsole
Copy link
Contributor Author

Some other things we need to worry about in the current build:

% gradle --warning-mode all

> Configure project :
The org.gradle.api.plugins.Convention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.9/userguide/upgrading_version_8.html#deprecated_access_to_conventions
The org.gradle.api.plugins.JavaPluginConvention type has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: https://docs.gradle.org/8.9/userguide/upgrading_version_8.html#java_convention_deprecation

upgrading_version_8.html

@jeffscottbrown
Copy link
Member

what about upcoming gradle 9 compatablility?

Is there something coming in 9 that will help simplify the build?

@codeconsole
Copy link
Contributor Author

Is there something coming in 9 that will help simplify the build?

It's not a Gradle thing.
Grails 6 just went down a path that over complicated the build. I am sure there were good intensions, but for 99% of the apps it adds more burden. Going back to how It was in 5 would simplify it.

Publishing the grails gradle plugin to the Gradle plugin repository would dramatically simplify the build further.

@jeffscottbrown
Copy link
Member

It's not a Gradle thing.

What is it you are asking about when you asked about Gradle 9 compatibility?

@codeconsole
Copy link
Contributor Author

It's not a Gradle thing.

What is it you are asking about when you asked about Gradle 9 compatibility?

I was asking James if that was the motivation for why it got so complicated from 5 -> 6 and it was not. Using buildscript {} is not needed and the whole build configuration can be greatly simplified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

3 participants