-
-
Notifications
You must be signed in to change notification settings - Fork 951
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 Shell for Grails 7 #13569
Comments
@rainboyan are you able to help with this? |
If bring Shell back, how about the Forge? Do we need to maintain two CLI, The Forge use Micronaut CLI and provides Web UI, but Shell should maintain https://GitHub.com/grails-profiles and release all the profiles again. They are totally different. |
Right now we need grails-shell so that IntelliJ Grails Plugin isn't broken. It is not ideal to maintain two CLIs. We need the Web UI. Is it possible to migrate everything into the Micronaut CLI? For instance, is it possible to get GrailsApplicationCommands that are in a plugin to autocomplete in the Micronaut CLI? What do you recommend @rainboyan ? |
I don't think the Forge cli will handle the pieces missing from Grails Shell cli. With the Forge (Picocli/Rocker template) path Forge handles application generation with a set of commands and features and Forge does not include or call Gradle. Everything build and historical custom plugin script related is handled by Gradle directly. Forge covers part of what Grails Shell handled, the web UI pretty much surfaces it all, and diverts the rest to Gradle directly and through the migration of custom scripts to GrailsApplicationCommand like S2QuickstartCommand "While the revamped CLI [Forge] offers enhanced performance, it operates entirely offline, lacking awareness of the Grails application or its plugins. This change disrupts the traditional approach to executing custom scripts within the Grails environment. Previously, developers could create custom scripts to automate tasks or extend functionality. However, with the CLI’s new offline mode, the concept of custom scripts becomes obsolete." More details in the links on: https://github.com/orgs/grails/discussions/13562 Grails Forge CLI 6.2.0
|
The migration to Forge (Picocli/Rocker template) also explains why the generated application.yml is so much simpler than it was historically. PR to put environments back into the default.
|
@jamesfredley I am not a big fan of including the IntelliJ plugin works:
IntellJ plugin does not work:
|
I have created a fresh app using Grails 6.2.0 but haven't reproduced the issues as you said. Execute below command successfully in IDEA 2024.1.4, what am I missing? runCommand "-Pargs=generate-controller Comment" Also I installed spring-security-core plugin successfully, before executing the command s2-quickstart, I should create the missing file conf/spring/resources.groovy first. | Error Command execution error: grails-app/conf/spring/resources.groovy (No such file or directory) |
@rainboyan The easiest ways to experience the issue with the IntelliJ Grails Plugin in the Run Configuration widget which will have an X on it for Grails run configuration. It does not impact directly calling Gradle commands. Since the IntelliJ Grails Plugin doesn't load all of the enhanced functionality it provides is not loaded. You can still technically develop and run the Grails app, you are just missing the plugin enhanced functionality. You can also Reload the Gradle project and see the exception. |
@jamesfredley Yeah I got it. The Tools/Grails menu will be available only after I added grails-shell dependency. I think this issue is due to IntelliJ Grails Plugin, the plugin should be updated to Grails 6.2, it should remove the dependency. I guess it use GrailsCli class to recognise the project as a Grails project. |
@codeconsole the following will exclude it from the jar. Depending upon which generated lib or distribution you use you might need to also do this for one or more of
|
@rainboyan I couldn't locate the IntelliJ Grails plugin code, but it I'd guess it might look for Grails Wrapper additionally in Grails 4 and earlier projects. A good portion of the plugin relies on being able to call the grails shell, like the New menus which use Since so many projects are Grails 5 and earlier and there are still many current things with 6.2 that need to call grails shell, my opinion is that grails shell should stick around as the bridge until everything can easily work another way. When I read through those IntellIJ tickets at the top of this issue, I worried about how many devs gave up on Grails since the bridge was missing. Grails Shell and Grails Forge CLI can coexist in the interim, I believe. Neither is included in a default application and Grails Forge CLI seems to be architected to be separate from the Grails app. |
@jamesfredley yeah the Grails IntelliJ Grails Plugin is not Open Source, so I don't use it, I'm a heavy CLI user. While I can't locate the plugin code, I'm sure IDEA uses grails-shell as a criterion to identify Grails projects.
I believe it too. |
I have no idea. I'm not familiar with Micronaut CLI, if speed is the advantage of the GraalVM, but you will lose some dynamic flexibility. |
@jamesfredley there is an issue with that approach, you get 7MB in bonus jars to exclude
need to turn off transitive as well
|
@jamesfredley so I am wondering how we can get IntelliJ to resolve grails-shell in 6.2.1 without having to put it in the build path. We probably need to first figure out how it is resolving it in 5.x
Does it have something to do with the grails-wrapper.jar? @rainboyan thoughts? |
@codeconsole It was these changes which you restored to 624c421#diff-17de776cf455cc117e083046d7ff463380a53ea6c58d8bf241388ce504b6032e I just tested it against your website project using Grails 6.2.1-SNAPSHOT and grails shell 6.1.2 is available for IntelliJ, but does not get put into the build path. |
@jamesfredley I am not following you?Why would 6.1.2 be available? wouldn't it be 6.2.1-SNAPSHOT? |
@codeconsole I was getting grails-shell:6.1.2 because of So updating gradle.properties
and buildSrc/gradle.build
gives you grails-shell:6.2.1-SNAPSHOT on the runtimeClasspath |
@jamesfredley so my previous comment was in regards to why it has to be added and in a 5.x project it does not.
shows @rainboyan @jamesfredley should we roll back profile task as well? |
@codeconsole What you found on the
grails-shell needs profiles to run the app, gradle does not
|
If we don't use Shell to create apps with Profiles, it is not needed anymore. |
Is the Forge shell capable of loading auto completing Application Commands from plugins? |
No, this is the complete list of commands for Forge. Quote from https://medium.com/@puneetbehl/a-comprehensive-guide-to-custom-application-command-in-grails-framework-f7496406ac50: "it operates entirely offline, lacking awareness of the Grails application or its plugins. This change disrupts the traditional approach to executing custom scripts within the Grails environment."
|
Grails moved in the direction of embracing Gradle instead of maintaining two ways of doing the same thing. The old grails shell commands and grails tasks. |
This effort is to provide time and a bridge until a higher percentage can be converted from the old Grails Shell CLI way to the new ways:
When Grails Shell was removed in Grails 6 for new default Grails apps, several significant things broke, that will still be there in 7, and this is an attempt to make that transition smoother, especially for new grails developers. |
@sdelamo from what James is saying it is not 2 ways of doing the same thing if embracing gradle is not even capable of doing the same thing. The way it was removed completely broke everything. Grails 6.2 resulted in a completely broken cli and completely broke the InteliJ plugin which a large percentage of developers depend on. |
For IntelliJ Idea to recognize and function normally with the Grails 6.2.0 project, I added the dependency
To exclude it from the final artifact, I put it in the build.gradle like this: if I don't remove the Grails shell from the final artifact, it will give an error when deploying to Tomcat.
|
There is a need for Grails Shell 7 for Grails 7 to support plugins using Custom Scripts, other Custom Scripts, IntelliJ Grails Plugin including the Run Grails Command and all other plugin functionality, etc. This will coexist with the new Forge CLI as time allows for migration of code and documentation to the new Forge and Gradle ways.
Discussion: https://github.com/orgs/grails/discussions/13562
PRs where grails-shell was removed.
https://github.com/grails/grails-core/pull/13407/files
https://github.com/grails/grails-gradle-plugin/pull/313/files
https://youtrack.jetbrains.com/issue/IDEA-353327/IDE-does-not-recognize-Grails-6.2.0-projects
https://youtrack.jetbrains.com/issue/IDEA-327614/Idea-Intellij-does-not-recognize-a-project-with-grails-6
https://youtrack.jetbrains.com/issue/IDEA-351413/IntelliJ-IDEA-2024.1-fails-to-load-Grails-6.2.0-project-correctly
https://youtrack.jetbrains.com/issue/IDEA-356545/Grails-Resources-not-linkable-via-Editor-asset
#13523 - outstanding issue with using
gradlew runCommand -Pargs="generate-controller sampleapp.ClassA"
The text was updated successfully, but these errors were encountered: