Grails - generate-all在没有提示覆盖的情况下继续进行?[y,n,a]

时间:2015-01-15 05:57:22

标签: grails grails-2.4

每当我尝试构建gen​​erate-all命令时,它会提示我覆盖?[y,n,a]进行输入。有没有办法选择' y'默认情况下。

修改 我是第一次设置框架,我经常更改模型并生成视图和控制器以进行检查。

更新:选择选项' a'它会自动覆盖所有文件,而不是每次都提示。

3 个答案:

答案 0 :(得分:2)

如果你通过谷歌登陆这里。

新Grails(3.x)对regenerate generated files

有“-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                                                 

答案 1 :(得分:1)

没有选项可以做到这一点,因为此提示是为了保护现有代码不被意外覆盖。

请您详细说明您的需求和理由,以便任何人都可以为您提供替代方案吗?

答案 2 :(得分:1)

Grails版本:3.2.8 命令是 $ grails generate-all bookstore.Author -force

相关问题