我想显示来自 ant 脚本的密码输入对话框。这是我的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>
此代码永远挂起。怎么了?
更新: 我正在 Mac OS X 10.8.2 和 Oracle JDK 7u13 中进行测试