每次我尝试构建 generate-all 命令时,它都会提示我 Overwrite?[y,n,a] 进行输入。有没有办法默认选择'y'。
编辑: 我是第一次设置框架,我经常更改模型并生成要检查的视图和控制器。
更新:选择选项'a',它将自动覆盖所有文件,而不是每次都提示。
每次我尝试构建 generate-all 命令时,它都会提示我 Overwrite?[y,n,a] 进行输入。有没有办法默认选择'y'。
编辑: 我是第一次设置框架,我经常更改模型并生成要检查的视图和控制器。
更新:选择选项'a',它将自动覆盖所有文件,而不是每次都提示。
万一你通过谷歌登陆这里。
新 grails (3.x) 具有“-force”选项来重新生成生成的文件
$ grails generate-all bookstore.Author
Warning |
Destination file grails-app\controllers\bookstore\AuthorController.groovy already exists, skipping...
Warning |
Destination file src\test\groovy\bookstore\AuthorControllerSpec.groovy already exists, skipping...
Warning |
Destination file grails-app\views\author\edit.gsp already exists, skipping...
Warning |
Destination file grails-app\views\author\create.gsp already exists, skipping...
Warning |
Destination file grails-app\views\author\index.gsp already exists, skipping...
Warning |
Destination file grails-app\views\author\show.gsp already exists, skipping...
|Scaffolding completed for grails-app\domain\bookstore\Author.groovy
$ grails generate-all -force bookstore.Author
|Rendered template Controller.groovy to destination grails-app\controllers\bookstore\AuthorController.groovy
|Rendered template Spec.groovy to destination src\test\groovy\bookstore\AuthorControllerSpec.groovy
|Rendered template edit.gsp to destination grails-app\views\author\edit.gsp
|Rendered template create.gsp to destination grails-app\views\author\create.gsp
|Rendered template index.gsp to destination grails-app\views\author\index.gsp
|Rendered template show.gsp to destination grails-app\views\author\show.gsp
|Scaffolding completed for grails-app\domain\bookstore\Author.groovy
不,没有这样做的选项,因为这个提示是为了保护现有代码不被意外覆盖。
您能否详细说明您的需求和这样做的原因,以便任何人都可以为您提供替代方案?
在 Grails 版本:3.2.8 中命令是 $ grails generate-all bookstore.Author -force