grails / grails-gradle-plugin

Apache License 2.0
6 stars 9 forks source link

BUG: Including org.grails.grails-gsp should automatically configure gsp compilation for web apps. #234

Open codeconsole opened 10 months ago

codeconsole commented 10 months ago

As of Grails 6.0.0, it is now required to add the following to an apps build.gradle

tasks.withType(War).configureEach { War war ->
    war.dependsOn compileGroovyPages
}

This should be configured automatically by the plugin. Previous versions of grails did not require this and the mention of the required addition was not added to the release announcement or release notes for 6.0.0

matthijsbierman commented 10 months ago

With Grails 6.0.0 installed through SDKman, I see that snippet in build.gradle after running:

grails create-app com.example.app

Using https://start.grails.org/ it also shows the required snippet.

codeconsole commented 10 months ago

@matthijsbierman that snippet shouldn’t be necessary and the plugin should automatically configure that behavior

matthijsbierman commented 10 months ago

@codeconsole I see what you mean. Agreed, it would be best if the plugin itself configures it.

puneetbehl commented 10 months ago

This is already in place at https://github.com/grails/grails-gradle-plugin/blob/6.1.x/src/main/groovy/org/grails/gradle/plugin/web/gsp/GroovyPagePlugin.groovy#L87

Could you please verify if it still works after removing it from the build.gradle for Grails 6.1.0-SNAPSHOT?

codeconsole commented 10 months ago

Sure, I will check

codeconsole commented 10 months ago

@puneetbehl

I can confirm that the following is no longer needed:

tasks.withType(War).configureEach { War war ->
    war.dependsOn compileGroovyPages
}

I did notice one other thing. It seems like the source gsp pages are also included. Is this expected behavior?

     3204  10-25-2023 17:37   WEB-INF/classes/layouts/main.gsp
     2538  10-25-2023 17:37   WEB-INF/classes/sample/edit.gsp
     2191  10-25-2023 17:37   WEB-INF/classes/sample/show.gsp
     2329  10-25-2023 17:37   WEB-INF/classes/sample/create.gsp
     1701  10-25-2023 17:37   WEB-INF/classes/sample/index.gsp
     3880  10-25-2023 17:37   WEB-INF/classes/index.gsp

Also, has the code block been removed from the results of grails create-app ? I am not sure where to check for that. How is the base build.gradle generated? Where is base source code for that?

puneetbehl commented 10 months ago

I think the class responsible for generating the build.gradle is https://github.com/grails/grails-forge/blob/6.1.x/grails-forge-core/src/main/java/org/grails/forge/build/gradle/GradleBuild.java

codeconsole commented 10 months ago
     3204  10-25-2023 17:37   WEB-INF/classes/layouts/main.gsp
     2538  10-25-2023 17:37   WEB-INF/classes/sample/edit.gsp
     2191  10-25-2023 17:37   WEB-INF/classes/sample/show.gsp
     2329  10-25-2023 17:37   WEB-INF/classes/sample/create.gsp
     1701  10-25-2023 17:37   WEB-INF/classes/sample/index.gsp
     3880  10-25-2023 17:37   WEB-INF/classes/index.gsp

I did notice one other thing. It seems like the source gsp pages are also included. Is this expected behavior?

@puneetbehl ?