I want to show a password input dialog from ant script. Here's my code from build.xml:
<target name="sign" unless="isUpToDate">
<script language="javascript">
importClass(javax.swing.JPasswordField);
importClass(javax.swing.JOptionPane);
var pf = new JPasswordField();
var okCxl = JOptionPane.showConfirmDialog(null, pf, "Enter Password", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (okCxl == JOptionPane.OK_OPTION) {
project.setNewProperty("keypass", pf.getPassword());
} else {
throw "Password is required";
}
</script>
<echo message="${keypass}"></echo>
...
</target>
This code hangs forever. What's wrong?
Update: I'm testing in Mac OS X 10.8.2 and Oracle JDK 7u13