Skip to content
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

The "s2-quickstart" command fails to execute when the resources.groovy file does not exists #1001

Open
puneetbehl opened this issue Mar 14, 2024 · 5 comments
Assignees

Comments

@puneetbehl
Copy link
Contributor

puneetbehl commented Mar 14, 2024

Expected Behavior

I believe it should automatically create the resources.groovy file if it does not exists, otherwise it should add to the existing file.

Actual Behaviour

The build failed while running the command

./gradlew runCommand -Pargs="s2-quickstart example.ssdemo User Role"

The Command Line Logs:

➜  ssdemo ./gradlew runCommand -Pargs="s2-quickstart com.package.app User Role"  

> Task :runCommand

Configuring Spring Security Core ...
... finished configuring Spring Security Core
Grails application running at http://localhost:0 in environment: development
| :runCommand
Creating User class User in package com.package.app
| 
Creating Role class Role in package com.package.app
Rendered template PersonWithoutInjection.groovy.template to destination grails-app/domain/com/package/app/User.groovy
Rendered template PersonPasswordEncoderListener.groovy.template to destination src/main/groovy/com/package/app/UserPasswordEncoderListener.groovy
| Error Command execution error: grails-app/conf/spring/resources.groovy (No such file or directory)

> Task :runCommand FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':runCommand'.
> Process 'command '/Users/behl/.sdkman/candidates/java/11.0.17-zulu/zulu-11.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* 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 9s

Steps To Reproduce

  1. Either Forge from https://start.grails.org or create new Grails application from the Grails CLI.
grails create-webapp example.ssdemo
  1. Add the Spring Security Core Plugin dependency to the build.gradle file, as:
implementation("org.grails.plugins:spring-security-core:6.1.1")
  1. Execute the s2-quickstart command from Gradle as:
./gradlew runCommand -Pargs="s2-quickstart example.ssdemo User Role"

Environment Information

  • Operating System: macOS Sonoma 14.3
  • Java: openjdk 11.0.17 2022-10-18 LTS
  • Grails: 6.1.2
  • Spring Security Core Plugin: 6.1.1

Example Application

No response

Version

6.1.2

@pangeaos
Copy link

pangeaos commented Apr 8, 2024

Same issue!

@monetschemist
Copy link

monetschemist commented Apr 30, 2024

@puneetbehl Rather than the problem being resources.groovy, in my experience it's the directory grails-app/conf/spring not being created beforehand. Whether that's something grails create-app should do or the s2-quickstart invocation should check and fix, I don't know.

But for sure / confirmed, if I create the grails-app/conf/spring directory before running s2-quickstart, all goes according to plan.

update

In my case, the s2-quickstart fails after creating User.groovy in the grails-app/domain directory and UserPasswordEncoderListener.groovy in the src/main/groovy directory. If I delete those two files and create the grails-app/conf/spring directory and then re-run s2-quickstart, I end up with a working situation and seemingly no ill effects.

@puneetbehl puneetbehl assigned puneetbehl and unassigned Richardson-e May 2, 2024
@puneetbehl
Copy link
Contributor Author

@monetschemist I believe the s2-quickstart command should work without the need for directory to exits beforehand.

@monetschemist
Copy link

@puneetbehl I think you must be correct. Do other parts of the Grails ecosystem use grails-app/conf/spring? If so, do they create the directory if necessary?

@monetschemist
Copy link

@puneetbehl today, 28 October 2024, I created my first project using Grails 6.2.1 and then ran s2-quickstart, forgetting to create the grails-app/conf/spring directory beforehand. Nevertheless, s2-quickstart ran fine. I attribute this to Grails 6.2.1 creating the directory, since I continue to use the same Spring Security Core plugin version 6.1.1 as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants