运行此脚本时 Apache Ant 被冻结 [英] Apache Ant gets frozen while running this script

查看:22
本文介绍了运行此脚本时 Apache Ant 被冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示来自 ant 脚本的密码输入对话框.这是我来自 build.xml 的代码:

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?

更新:我正在 Mac OS X 10.8.2 和 Oracle JDK 7u13 中进行测试

Update: I'm testing in Mac OS X 10.8.2 and Oracle JDK 7u13

推荐答案

作为替代,将 所需的 storepass 放在一个不可见的文件中,例如.deployconf,只有用户才能访问:例如400600.在ant中加载密码,根据需要使用:

As an alternative, put the storepass required by <signjar /> in an invisible file, e.g. .deployconf, having user-only access: e.g. 400 or 600. Load the password in ant, and use as required:

<loadfile srcfile="${user.home}/.deployconf" property="deployconf"/>

这与 <signjar/> 配合得很好,尽管可能需要付出一些努力才能将换行符排除在 .deployconf 之外.

This works well with <signjar />, although some effort may be required to keep linefeeds out of .deployconf.

这篇关于运行此脚本时 Apache Ant 被冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆