我想创建一个命令行工具来生成一些Java源代码...例如,控制器类,服务类和DTO类。我一直在尝试找到CreateController.groovy的脚本(来自grails),但是我没有运气找到该脚本。任何帮助将非常感激。我认为可以用Gant完成?
我一直在寻找CreateController.groovy的脚本。(来自grails),但是我没有运气找到该脚本。
您尚未指出要使用的Grails版本,这可能是相关的。对于最新版本的Grails,没有CreateController.groovy
,但在create-controller
中定义了https://github.com/grails/grails-profile-repository/blob/master/profiles/web/commands/create-controller.yml命令。
我认为可以用Gant完成?
不是自Grails 2起。如果您使用的是Grails 1或2,那么您可能正在寻找Gant脚本。对于Grails 2.5.6,该命令定义在https://github.com/grails/grails-core/blob/bd7cc10e17d34f20cedce979724f0e3bacd4cdb4/grails-scripts/src/main/scripts/CreateController.groovy。
为什么要重新发明轮子?这种工具已经存在。
让我们看看Telosys:http://www.telosys.org/
如果需要CLI工具,则可以尝试Telosys-CLI:http://www.telosys.org/cli.html(另请参见https://github.com/telosys-tools-bricks/telosys-cli/wiki)
要生成Java源代码,您可以使用现有模板(http://www.telosys.org/templates.html,也可以自定义这些模板或创建自己的模板
查看模板GitHub组织https://github.com/telosys-templates-v3中所有以“ java7”开头的模板捆绑包
例如: