grails / grails-forge

This is Grails project creator. Grails projects may be created using the browser interface, Command Line, or via CURL.
Apache License 2.0
3 stars 8 forks source link

Grails 6 Completely Overcomplicated create-app build Environment #347

Open codeconsole opened 1 month ago

codeconsole commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

@jamesfredley what about upcoming gradle 9 compatablility?

jamesfredley commented 1 month ago

@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 commented 1 month ago

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