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 dialo开发者_C百科g like this in ant?
Sounds like you want to create a custom InputHandler.
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
精彩评论