grails-spring-security-core
grails-spring-security-core copied to clipboard
The "s2-quickstart" command fails to execute when the resources.groovy file does not exists
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
- Either Forge from https://start.grails.org or create new Grails application from the Grails CLI.
grails create-webapp example.ssdemo
- Add the Spring Security Core Plugin dependency to the build.gradle file, as:
implementation("org.grails.plugins:spring-security-core:6.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
Same issue!
@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.
@monetschemist I believe the s2-quickstart
command should work without the need for directory to exits beforehand.
@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?