如何在 grails gant 脚本中调用非默认目标
我有一个甘特脚本 A 有两个目标
t1 - 默认目标 t2 - 另一个目标
即使当我运行
grails A t2
时,默认目标也会运行?如何运行非默认目标? 我已经尝试过 grails A --target='t2' 等,但不起作用。
I have a gant script A with two targets
t1 - default target
t2 - another target
Even when I run
grails A t2
the default target is run? How can I run the non-default target?
I have tried grails A --target='t2' etc. but doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不确定是否有正确的方法来做到这一点,但是您可以编写第二个脚本(“T2.groovy”)来加载这个脚本并将该目标设置为其默认值,例如
I'm not sure if there's a proper way to do it, but you can write a second script ("T2.groovy") that loads this one and sets that target as its default, e.g.
对 argsParsing 方法的一个调整是运行 argsMap 中的元素并迭代地依赖它们。因此,您可以将脚本称为:
grails myScript do-this do-that do-the-other
snip
snip
A tweak to argsParsing approach is to run through elements from the argsMap and iteratively depend on them. So you could call your script something like:
grails myScript do-this do-that do-the-other
snip
snip
这是我采取的另一种方法
snip
您使用参数运行脚本。该参数是要运行的方法的名称:) 然后执行该方法。
This is another approach that I took
snip
You run the script with a parameter. That parameter is the name of the method to run :) That method then get's executed.