Ant 中的文件夹选择
作为构建的一部分,我将文件复制到用户指定的文件夹中。现在我正在这样做:
<input message="Select Drive to Install Trainer"
addproperty="trainer.drive" validargs="c:/,d:/,q:/,z:/" />
<input message="Enter Directory to Install Trainer"
addproperty="trainer.user.dir"/>
<property name="trainer.dir" value="${trainer.drive}${trainer.user.dir}"/>
因此,用户选择驱动器号,然后输入文件夹的路径,例如:“workspaces/myworkspace”,
这将设置trainer.dir 到:“c:/workspaces/myworkspace”
有更好的方法吗?
例如,有没有办法在 ant 中调出这样的对话框?
As part of a build I am copying files to a user specified folder.. Right now I am doing it like this:
<input message="Select Drive to Install Trainer"
addproperty="trainer.drive" validargs="c:/,d:/,q:/,z:/" />
<input message="Enter Directory to Install Trainer"
addproperty="trainer.user.dir"/>
<property name="trainer.dir" value="${trainer.drive}${trainer.user.dir}"/>
So a user selects the drive letter, then enters the path to the folder like: "workspaces/myworkspace"
Which sets the trainer.dir to: "c:/workspaces/myworkspace"
Is there a better way to do this?
For instance, is there a way to bring up a dialog like this in ant?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您想创建一个自定义 InputHandler。
Sounds like you want to create a custom InputHandler.
也许AntForm就是您正在寻找的:)
它是一个java工具,旨在为Ant添加交互通过图形形式编写脚本。
来自他们的网站:
为什么使用 AntForm?
由于自动化只能推进到需要用户输入为止,因此 Ant 开发人员将在运行时提示用户输入某些属性值。当这些属性的数量增加并且某些属性值变得依赖于其他属性值时,将输入划分为表单流是有意义的。 AntForm 使您能够做到这一点。
简而言之,为了与语言级别上控制台到 GUI 的自然演变保持一致,AntForm 引入了以前存在阅读值视图的现在形式范式。
AntForm 项目的目标是提供一个简单的 GUI,它提供以下功能:
用于修改属性的输入表单
启动 ant 目标的基于按钮的菜单
Maybe AntForm is what you are looking for :)
It is a java tool designed to add interaction to Ant scripts through graphical forms.
From their site :
Why use AntForm?
Because automation can only be pushed so far until user input is required, the Ant developper will resort to prompting the user for certain property values at runtime. When the number of these properties increases and certain property values become dependant on others, it makes sense to divide the input into a flow of forms. AntForm enables you to do this.
In short, in keeping with the natural evolution of console-to-gui at the language level, AntForm ushers in the present-form paradigm where a read value view existed before.
The goal of the AntForm project is to provide a simple GUI that provides the following:
Input forms for modifying properties
Button-based menus that launch ant targets