Grails-7 questions. currently when I run my app a...
# questions
u
Grails-7 questions. currently when I run my app as executable war file I have to do this in my build.gradle:
Copy code
bootWar {
    from('grails-app/views') {
        into 'WEB-INF/grails-app/views'
    }
Copy code
}
u
I found this very likely could be either gson files or gsp files not compiled correctly. I now turned both gson and gsp view comileStatic to false(otherwise there will be tons of compilation errors) However, when i trace into the groovyPageResolvers, I found the precompiledGspMap property did not get injected correctly, So, the gspResolver has to use a ResourceResolver instead of precompiledGspMap to resolve the gsp views. That's why it need the source code for the gsp pages to get the view resolved. This is so far I found.
j
Do you have an example project we could look at your configuration? There's so many things that could go wrong here that I can't really help without an example
@James Fredley may have a better idea on first glance
u
I will try to build one example. As my project is kind of big. I am starting with a new Grails 7 project try to re-produce this issue by adding more my production code into it. If I started simple project, everything works by far. It might take me some time to get this fully reproduced.
j
usually issues like this are caused by third party plugins or a misconfiguration.
(third party as in plugins using an older version of grails)
u
Yes. I am pretty certain of that. As if I build a simple grails7 project it works fine. This is the working project with some basic plugins from Grails 7, (asset pipeline, db migration, spring security), I still did not add spring session and spring data(redis) yet. will work on it to find out. By now I found is that my precompiledGspMap is not being populated correctly, I just do not know why.
j
at first glance, I don't see anything that sticks out - but i'm not sure what dc_common is - assume it's your local plugin
u
yes. that's my own plugin.
j
did you do a clean / remove your build directories before you upgraded?
u
yes. very clean
j
try building with the args
--no-build-cache --rerun-tasks
just to make sure it's not a gradle cache issue
or something caused by a gradle cache rather
u
Nah, it should not be. the only suspicious error now, I have to turn off all compileStatic for both gson and gsp. So I am thinking maybe that could be related.
j
not sure why that would impact it
we did make some changes in the RC2 related to project structure in gradle. That's why i'm curious if it's a cache issue. You've confirmed the compiled gsp classses are inside of the war, yes?
and i'm assuming you're using tomcat then? (i personally use the jar file is why i'm asking)
g
Yes. they are. both under WEB-INF/classes. However, I am not sure if all of them are compiled correctly. because there are too many of them. I then wonder if some of the gsp or gson are not compiled, so the precompiledGspMap refused to load. That’s why it tried to look up the source code by using
grails-app/views/my_app/view
instead of the
/my_app/view
j
the compiler should error if it doens't compile
g
With compileStatic=false, it wont error out
j
oh, you mean the rendering of the page itself
g
yes
j
what were the compilation errors?
you said there were "tons"
if you're using javax , you'll have to replace iwth jakarta, etc
g
I can run the app correctly without any error if I do grails run-app in developement mode. I only get these errors when I use an executable war file.
That suggested that all my grails 7 migration should be fine. otherwise the run-app will not work
j
i think run-app uses a special development mode to load the files incrementally
so you may have real issues with the gsps
g
Yeah. I need to find that out
But, those Gsps are working fine with Grails 6
@jdaugherty thanks all your help provided, I will keep this thread updated with my findings
j
The simplest way to debug these is usually to start with a clean app from start.grails.org and then layer on your customizations. From the screeenshot listing the plugins I can see you are missing grails-layout, which is why the CSS is not styling the page.
j
the screen shot shows "layout" which is the name of thge plugin in the grails-layout package
j
I see, it looked so much the other scenario
j
We still haven't seen an example error
@gaolei if you can show us one of those errors we can give you guidance
g
Will do
u
@jdaugherty @James Fredley I found some of spring beans, failed to start with autoConfiguration. I have to disabled them by adding them into the excluding list as below: Now two of my apps can at least start without any issues. Some of them I have to use a Groovy(Java) configuration to set it up(Like Redis)
Copy code
autoconfigure:
    exclude:
      - org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration
      - org.springframework.boot.autoconfigure.security.servlet.SecurityFilterAutoConfiguration
      - org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
      - org.springframework.boot.actuate.autoconfigure.security.servlet.ManagementWebSecurityAutoConfiguration
      - org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration
      - org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration
      - org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration
      - org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration
      - org.springframework.boot.autoconfigure.reactor.netty.ReactorNettyAutoConfiguration
      - org.springframework.boot.autoconfigure.webflux.WebFluxAutoConfiguration
      - org.springframework.boot.autoconfigure.webflux.client.WebClientAutoConfiguration
u
I set up a break point at this file at 610, then I can figure out all the auto configuration failed beans then exclude them.
j
Please add this as an issue on https://github.com/apache/grails-core/issues
👍 1
g
will do