https://grails.org/ logo
Join Slack
Powered by
# questions
  • u

    user

    08/04/2025, 4:44 PM
    I’m currently using Grails 2.5.6 and trying to build a WAR file (
    grails dev war
    ) without any front-end files that I don’t need. • First, I tried excluding them in
    Config.groovy
    using:
    Copy code
    grails.assets.excludes = [
        "**/*.gsp",
        "**/*.js",
        "**/*.css",
        "**/*.ts",
        "**/*.png",
        "**/*.jpg",
        "**/*.jpeg",
        "**/*.gif",
        "**/*.svg",
    ]
    However, the
    .gsp
    files were still included in the WAR. • Next, I tried excluding them in BuildConfig.groovy:
    Copy code
    grails.project.war.excludes = [
        '**/*.gsp',
        'WEB-INF/grails-app/views/**/*'
    ]
    
    grails.war.resources = { stagingDir ->
        delete(includeEmptyDirs: true) {
            fileset(dir: "${stagingDir}/WEB-INF/grails-app/views") {
                include(name: '**/*.gsp')
            }
        }
    
        def pluginsDir = new File("${stagingDir}/WEB-INF/plugins")
        if (pluginsDir.exists()) {
            delete(includeEmptyDirs: true) {
                fileset(dir: pluginsDir.absolutePath) {
                    include(name: '**/*.gsp')
                }
            }
        }
    
        delete(includeEmptyDirs: true) {
            fileset(dir: "${stagingDir}/WEB-INF/classes") {
                include(name: '**/*_gsp.class')
            }
        }
    }
    But the .gsp files are still being packaged. Question: How can I reliably remove all
    .gsp
    files from the WAR file in Grails 2.5.6?
  • f

    Felipe

    08/04/2025, 6:12 PM
    Good afternoon, everyone. How's it going? I'm working on a project using Grails 2.5.6. We're currently in the process of upgrading to Grails 4. However, when generating the WAR file for this project, I'm encountering the following error:
    Copy code
    | Error WAR packaging error: archive contains more than 65535 entries.
    From what I understand, this error is due to a limitation in the ZIP format. I saw some recommendations to use ZIP64, but it seems it's not supported in my current version. Does anyone know of any alternative solutions to resolve this issue?
    j
    • 2
    • 3
  • n

    ngraff

    08/05/2025, 5:09 PM
    Hello, Trying to upgrade to Grails 7 from Grails 6 using 7.0.0-M5. In one of my submodules/plugins under the plugins folder of the main app, I have a handful of gsps. On the main app bootRun I get this error that I don't see in Grails 6. I only put a very basic test.gsp in there as a test under a docs folder, see image. Any suggestions out there? Exception in thread "main" java.util.concurrent.ExecutionException: BUG! exception in phase 'semantic analysis' in source unit 'gsp_ic_docstest_gsp.groovy' Cannot invoke "String.equals(Object)" because "packageName" is null.
    j
    • 2
    • 6
  • g

    gaolei

    08/07/2025, 2:42 AM
    Hello, I am trying to use Grails 7.0.0-M5 to create a plugin. I just did a create-plugin, then I try to run
    Copy code
    gradle build.
    It failed with this error:
    Copy code
    > Configure project :
    Cannot resolve reloading agent JAR: Failed to resolve imported Maven boms: Cannot resolve external dependency org.springframework.boot:spring-boot-dependencies:3.5.3 because no repositories are defined.
    Required by:
        project :
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Build file '/Users/xxxx/work/dc/tmp_2/build.gradle' line: 19
    
    * What went wrong:
    A problem occurred evaluating root project 'test-common'.
    > Failed to apply plugin 'org.apache.grails.gradle.grails-plugin'.
       > Could not create task ':findMainClass'.
          > Could not create task of type 'FindMainClassTask'.
             > 'org.gradle.api.file.ConfigurableFileCollection org.gradle.api.file.ConfigurableFileCollection.convention(java.lang.Object[])'
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Get more help at <https://help.gradle.org>
    
    BUILD FAILED in 372ms
    If I run
    Copy code
    ./gradlw build
    It failed with this error:
    Copy code
    tmp_2 % ./gradlew build
    
    > Task :compileGroovy FAILED
    startup failed:
    /Users/xxx/work/dc/tmp_2/grails-app/init/test/common/BootStrap.groovy: 3: unable to resolve class jakarta.servlet.ServletContext
     @ line 3, column 1.
       import jakarta.servlet.ServletContext
       ^
    
    1 error
    
    
    [Incubating] Problems report is available at: file:///Users/xxx/work/dc/tmp_2/build/reports/problems/problems-report.html
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':compileGroovy'.
    > Compilation failed; see the compiler error output for details.
    
    * Try:
    > Run with --scan to get full insights.
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
    
    You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
    
    For more on this, please refer to <https://docs.gradle.org/8.14/userguide/command_line_interface.html#sec:command_line_warnings> in the Gradle documentation.
    
    BUILD FAILED in 1s
    What could be wrong?
    t
    j
    • 3
    • 4
  • o

    Onats Ong

    08/08/2025, 12:39 AM
    hey team, I'm revisiting grails again and trying to setup my IDE. I remember IntelliJ had a grails context support but it doesn't seem to be working now. Is there a 3rd party one that supports grails quite well?
    j
    • 2
    • 3
  • s

    Slackbot

    08/08/2025, 12:39 AM
    May I suggest "team" or "everyone" or "folks"? Not everyone here is a guy.
  • a

    Allison Martin

    08/08/2025, 9:06 PM
    Hi Colin, Yes, we have a Grails 6 app using Spring Security with our Angular app using cookies at /app/ws and REST at /app/api. We struggled for a while getting the /app/api mapping to stop issuing cookies but finally figured out that it was a configuration issue in our Spring Auth Filters. The config is:
    Copy code
    plugin:
        springsecurity: # Spring Security Plugin Configuration
          rest:
            token:
              storage:
                jwt:
                  secret: "Some secret key to dev, hope this is long enough."
                  expiration: 14400 # default expiration to 4 hours
              validation:
                enableAnonymousAccess: true
          filterChain:
            chainMap:
              - pattern: '/api/appVersion'
                filters: 'anonymousAuthenticationFilter,restTokenValidationFilter,restExceptionTranslationFilter,filterInvocationInterceptor'
              - pattern: '/api/**'
                filters: 'JOINED_FILTERS,-anonymousAuthenticationFilter,-exceptionTranslationFilter,-authenticationProcessingFilter,-securityContextPersistenceFilter,-rememberMeAuthenticationFilter' # Stateless chain
              - pattern: '/**'
                filters: 'JOINED_FILTERS,-restTokenValidationFilter,-restExceptionTranslationFilter' # Traditional chain
  • l

    lraynal

    08/12/2025, 11:52 AM
    Hi team, is it possible to add Spring Security to a Grails 7 RC1 app yet ? Dependency seems wrong here https://apache.github.io/grails-spring-security/7.0.x/core-plugin/guide/index.html , I can't see it in https://start.grails.org/ features
    j
    j
    • 3
    • 6
  • r

    rss

    08/12/2025, 6:34 PM
    Grails app + tomcat + spring boot - Memory usage is increasing while the application is idle I started to test docker to run my application and I had noticed my memory consume when use "docker stats". I see the memory used from the container increasing like, every f5 on my page or when my application still running but with no one action beeing made on the page. To have a short test, i cleaned one controller and leave it the most clean possible, like: package test class exampleController { def dataSource; static allowedMethods = [save: "POST", update: "POST", delete:...
  • u

    user

    08/13/2025, 1:05 PM
    Hello everyone, hope you’re doing well. I’m currently working on a project using Grails 2.5.6, and we’re in the process of upgrading to Grails 4. For now, I need to generate the WAR file, which I usually do with the command:
    grails dev war
    For some builds, I’d like to exclude asset files. I tried using the following command:
    Copy code
    RUN ./grailsw -Dgrails.env=[env] -Dgrails.war.exploded=true -Dgrails.assets.excludes="**/*.js,**/*.css,**/*.ts,**/*.scss,**/*.sass" war
    However, this command does not actually exclude the assets. Is there another way to exclude assets through the command line?
    j
    • 2
    • 2
  • i

    ilPittiz

    08/13/2025, 2:31 PM
    Hi all, I’m trying to upgrade my Grails 6.2.3 app to Grails 7, and I generated a brand-new Grails 7 project from Grails Forge. I picked • Grails 7.0.0-RC1 • Gorm MongoDB • Spring Boot Starter Tomcat • a few additional features (Gradle buildSrc, Grails web console, ect) to make it similar to my app Then in IntelliJ IDEA 2025.2 (latest version of IDE and plugins) I made sure to use JDK 17 (aarch64 distribution, as I’m on Apple silicon). My
    build.gradle
    is this
    Copy code
    plugins {
        id "war"
        id "idea"
        id "eclipse"
    }
    
    // Not Published to Gradle Plugin Portal
    apply plugin: "org.apache.grails.gradle.grails-web"
    apply plugin: "org.apache.grails.gradle.grails-gsp"
    apply plugin: "org.apache.grails.gradle.grails-gson"
    
    group = "grails7"
    
    repositories {
        mavenCentral()
        maven {
           url = '<https://repo.grails.org/grails/restricted>'
        }
    }
    
    dependencies {
        profile "org.apache.grails.profiles:web"
        developmentOnly "org.springframework.boot:spring-boot-devtools" // Spring Boot DevTools may cause performance slowdowns or compatibility issues on larger applications
        testAndDevelopmentOnly "org.webjars.npm:bootstrap"
        testAndDevelopmentOnly "org.webjars.npm:bootstrap-icons"
        testAndDevelopmentOnly "org.webjars.npm:jquery"
        implementation platform("org.apache.grails:grails-bom:$grailsVersion")
        [...]
        implementation "org.springframework.boot:spring-boot-starter-validation"
        console "org.apache.grails:grails-console"
        runtimeOnly "org.fusesource.jansi:jansi"
        [...]
        testImplementation "org.testcontainers:testcontainers"
    }
    
    compileJava.options.release = 17
    
    tasks.withType(Test) {
        useJUnitPlatform()
    }
    When IntelliJ syncs the project I get the error
    Copy code
    A problem occurred evaluating root project 'grails7_grailsforge'.
    > Plugin with id 'org.apache.grails.gradle.grails-web' not found.
    The same occurs for the other 2
    apply plugin:
    statements. If I comment them, I get another error
    Copy code
    > Could not find method profile() for arguments [org.apache.grails.profiles:web] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
    and then the same
    Could not find method
    error occurs for
    developmentOnly
    ,
    testAndDevelopmentOnly
    and
    console
    methods. What am I missing here? Thanks in advance for any advice!
    j
    j
    • 3
    • 17
  • u

    user

    08/14/2025, 12:08 AM
    Hey everyone, I am using grails 6.2.2. I am facing an issue where the views in the plugin are not updated when I make changes to them. If I make changes to the view in a plugin the. I have to restart the whole app. However, the views in the main project are updated. Is there anyway I can fix this issue?
    j
    • 2
    • 1
  • n

    ngraff

    08/15/2025, 9:18 PM
    Hello, in the process of upgrading from Grails 6 to Grails 7.0.0-RC1. Running into this below exception from our SQL Server database with Grails 7, but not with Grails 6. We are using multiple data sources defined in application.groovy. For this specific [blah] data source, we are using 2 different schemas with a default_schema of dbo. Either schema being used is defined in its proper domain. For Grails 7, is there was some kind of update in gorm where we need to specifically define schema level multi tenancy where we did not have to in Grails 6?
    Copy code
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception
    Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception
    
    	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:223)
    	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:146)
    	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:318)
    	... 120 common frames omitted
    Caused by: org.grails.datastore.mapping.core.exceptions.ConfigurationException: DataSource not found for name [blah] in configuration. Please check your multiple data sources configuration and try again.
    Caused by: org.grails.datastore.mapping.core.exceptions.ConfigurationException: DataSource not found for name [blah] in configuration. Please check your multiple data sources configuration and try again.
    
    	at org.grails.orm.hibernate.HibernateDatastore.getDatastoreForConnection(HibernateDatastore.java:363)
    	at org.grails.orm.hibernate.HibernateGormEnhancer.getStaticApi(HibernateGormEnhancer.groovy:51)
    	at org.grails.datastore.gorm.GormEnhancer.registerEntity(GormEnhancer.groovy:141)
    	at org.grails.datastore.gorm.GormEnhancer.<init>(GormEnhancer.groovy:124)
    	at org.grails.orm.hibernate.HibernateGormEnhancer.<init>(HibernateGormEnhancer.groovy:45)
    	at org.grails.orm.hibernate.HibernateDatastore.initialize(HibernateDatastore.java:445)
    	at org.grails.orm.hibernate.HibernateDatastore.<init>(HibernateDatastore.java:180)
    	at org.grails.orm.hibernate.HibernateDatastore.<init>(HibernateDatastore.java:216)
    j
    • 2
    • 1
  • g

    gaolei

    08/16/2025, 9:47 PM
    Hello, here, when I upgrade to Grails 7.0.0, I had code as
    Copy code
    grailsApplication['config']['my.default.property']
    This code stopped working and groovy compiler throws out an error:
    Copy code
    BUG! exception in phase 'class generation' in source unit '/Users/xxx/work/base_folder/DashboardController.groovy' At line -1 column -1
      On receiver: this.getGrailsApplication() with message: getAt and arguments: config
      This method should not have been called. Please try to create a simple example reproducing this error and file a bug report at <https://issues.apache.org/jira/browse/GROOVY>
    This is the code annotated with @GrailsCompileStatic, I still want to keep the @@GrailsCompileStatic, what would be an practical fix for this? Thanks
  • j

    jdaugherty

    08/16/2025, 9:48 PM
    isn’t config a property on grailsApplication? does it work if you change [‘config’] to .config ?
    g
    m
    • 3
    • 3
  • d

    domix

    08/17/2025, 9:15 PM
    Hello! I just created a fresh Grails 7.0-RC1 application with Forge
    j
    • 2
    • 16
  • g

    gaolei

    08/18/2025, 4:06 AM
    Hello community, me again, Still try to upgrade one of my products to grails 7, getting close, but still have issues: Now I have this error:
    Copy code
    Users_lei_[project_folder]_grails_app_views_layouts_main_gsp$_run_closure1$_closure9$_closure17.doCall(Users_[project_folder]_grails_app_views_layouts_main_gsp:24)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at org.grails.taglib.TagBodyClosure.executeClosure(TagBodyClosure.java:203)
    	at org.grails.taglib.TagBodyClosure.captureClosureOutput(TagBodyClosure.java:105)
    	at org.grails.taglib.TagBodyClosure.call(TagBodyClosure.java:216)
    	at org.grails.plugins.web.taglib.GrailsLayoutTagLib.captureTagContent(GrailsLayoutTagLib.groovy:53)
    	at org.grails.plugins.web.taglib.GrailsLayoutTagLib$_closure6.doCall(GrailsLayoutTagLib.groovy:213)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:449)
    	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:367)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
    	at Users_[project_folder]_grails_app_views_layouts_main_gsp$_run_closure1$_closure9.doCall(Users_[project_folder]_grails_app_views_layouts_main_gsp:27)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at org.grails.taglib.TagBodyClosure.executeClosure(TagBodyClosure.java:203)
    	at org.grails.taglib.TagBodyClosure.captureClosureOutput(TagBodyClosure.java:105)
    	at org.grails.taglib.TagBodyClosure.call(TagBodyClosure.java:216)
    	at org.grails.plugins.web.taglib.GrailsLayoutTagLib$_closure7.doCall(GrailsLayoutTagLib.groovy:231)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:449)
    	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:367)
    	... 40 common frames omitted
    Caused by: java.lang.NullPointerException: Cannot invoke "com.opensymphony.module.sitemesh.Page.getTitle()" because the return value of "org.codehaus.groovy.runtime.InvokerHelper.invokeMethodSafe(Object, String, Object)" is null
    	at org.grails.plugins.web.taglib.RenderGrailsLayoutTagLib$_closure4.doCall(RenderGrailsLayoutTagLib.groovy:319)
    	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    	at org.grails.gsp.GroovyPage.invokeTagLibClosure(GroovyPage.java:442)
    	at org.grails.gsp.GroovyPage.invokeTag(GroovyPage.java:367)
    	... 63 common frames omitted
    
    Caused by: java.lang.NullPointerException: Cannot invoke "com.opensymphony.module.sitemesh.Page.getTitle()" because the return value of "org.codehaus.groovy.runtime.InvokerHelper.invokeMethodSafe(Object, String, Object)" is null
    I am using sitemesh 2 with
    Copy code
    implementation "org.apache.grails:grails-layout"
    I compared my project settings with a working grails 7 sample app(sitemesh2 and grails-layout), i can not tell difference BTW: I found claude code helped quite a bit when you do the upgrations.
    j
    • 2
    • 3
  • s

    Steve Osguthorpe

    08/19/2025, 8:53 AM
    Hello... I'm after information on the EOL of Grails 6. Is Grails 6 still supported/updated or is it officially in maintenance with 7 being the ONLY community supported version. We need to update a few projects with this information and I'm not sure of the answers given the move to community support.
  • s

    Steve Osguthorpe

    08/19/2025, 8:56 AM
    And if there is a timeline for support of 7, i.e. when it'll be maintenance and when 8 is planned and EOL's etc that would be useful. I'm assuming that it will be less frequent than a (bi)yearly pre-planned release and will likely be 7 will be the main version until we need 8 and the timeline become more reactive?
    j
    • 2
    • 16
  • p

    pablo.pazos

    08/19/2025, 9:30 PM
    Hi all, quick question: is is possible to define a DATE(x) over a datetime field? (in the domain I have Date x, and DATE(x) is only the yyyy-mm-dd part, not the full datetime)
    g
    p
    m
    • 4
    • 18
  • p

    pablo.pazos

    08/21/2025, 4:50 AM
    Hi all, I'm trying to make a Date x map to date in MySQL instead of datetime(6). I tried mapping type, sqlType and formula, none of those are taken by $ grails dbm-gorm-diff (which checks changes on the domain and generates the migration scripts, it's generating just an empty changeSet). What am I doing wrong?
    b
    j
    • 3
    • 3
  • g

    gaolei

    08/21/2025, 7:44 PM
    Another Grails 7 question. Seemed it will not correctly pick the application.yml if I do (java 24, grails 7.0.0-RC1)
    Copy code
    gradle bootRun
    However, if I do
    Copy code
    gradle run
    application.yml will be correctly picked. ?
    j
    • 2
    • 4
  • a

    Arjang

    08/22/2025, 6:28 PM
    Just wondering, main.gsp always comes with
    Copy code
    <a class="navbar-brand" href="/#">
    Does that work for you? I always have to change it to
    Copy code
    <a class="navbar-brand" href="${createLink(uri:'/')}">
    j
    • 2
    • 3
  • c

    cjchalmers

    09/01/2025, 7:45 PM
    I am trying to implement a simple event publishing solution but fear I am barking up the wrong tree. I am using version 6.2.3. Basically I want to send emails when certain events take place (password change or reset) and thought publishing an event to a listener that subsequently sends the email would make sense. However the code I currently have is based on the Spring "ApplicationEventPublisher" and a listener on the Spring "@EventListener". In addition to this my listener is based under ./src/main/groovy as a Spring Component. Needless to say this is not working. The publish code runs but the Listener is either not running or at least not listening for an event. I saw the following docs - https://async.grails.org/latest/guide/index.html#notifying Does anyone have a simple example/pointers how to get this working? Basically I want to have a service that will Publish an Event after-which a generic Email Service can listen and act on this and take care of sending. The user wont notice any delay etc Much appreciated if someone can help me out
    j
    • 2
    • 4
  • c

    cjchalmers

    09/02/2025, 9:26 AM
    I am looking at integrating additional (Spring) beans under src/main/groovy It was my understanding that I could just annotate these with @Component and they'd be picked up. This doesn't seem to work for me. I can add them in the resources.groovy file and they would work there, albeit with constructor/method injection configured Is my understanding misplaced or do I have a config issue my side?
    s
    • 2
    • 2
  • r

    rss

    09/02/2025, 7:24 PM
    Swagger ui crashing(out of memory) in Springdoc + Grails/Groovy I'm trying to create a simple API with swagger documentation. I have this controller: @RestController @RequestMapping("/api/v1/authTest") @Tag(name = "Auth", description = "Endpoints") class AuthTest{ LoginAuth loginAuth @PostMapping("/token") @Operation(summary = "token test") AuthToken token(@RequestBody CredentialsAuth credentials) { try { return loginAuth.autenticate(credentials) } catch (ApiAuthException e) { throw new...
  • c

    cjchalmers

    09/03/2025, 8:08 PM
    I have a Grails 6.2.3 app, based on the API profile. One part of functionality is to send emails to users, for example for passwordResets. I do this using a gsp template. I added the following in Gradle next to json views to make that work • implementation "org.grails.plugins:gsp" Locally all works fine, now I am deploying to a test server as a bootable Jar and it's as though the template is not being compiled into the jar file. Does anyone have experience with this? Am I missing a dependency/plugin config? Is there an alternative to gsp templates? Any help/pointers much appreciated.
  • j

    jdaugherty

    09/03/2025, 8:08 PM
    You need to apply teh grails-gsp gradle plugin
    c
    • 2
    • 1
  • j

    jdaugherty

    09/03/2025, 8:08 PM
    so the gsps are compiled into the war / jar
  • r

    rss

    09/04/2025, 6:34 PM
    Groovy/Grails Ambiguous mapping error with springdoc swagger This is my controller package example.infra.adapters.input.api.v1.endpoints import example.aplication.services.authentication.LoginAuthenticator import example.aplication.dtos.authentication.CredencialsDTO import example.aplication.dtos.authentication.AuthenticationTokenDTO import example.aplication.exceptions.authentication.AuthenticationErrorException import org.springframework.web.bind.annotation.* import org.springframework.http.ResponseEntity import...