Ant build.xml需要用户输入,但Eclipse没有tty [英] Ant build.xml requires user input, but Eclipse has no tty

查看:92
本文介绍了Ant build.xml需要用户输入,但Eclipse没有tty的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图更好地将Eclipse与我的build.xml相集成。
我的构建文件为程序的本机部分调用GNU Make,Makefile使用sudo将编译的lib移植到系统路径中。
不幸的是,这需要输入密码,Eclipse的终端不接受用户输入。
因此,在eclipse中运行构建的结果是:

  [exec] sudo:没有tty存在和没有通过程序指定
[exec] make:*** [安装]错误1

围绕这个问题?蚂蚁的构建能否以其他方式提升到根源?

解决方案

设置一个单独的帐户,例如部署。修改 / etc / sudoers 以包括允许部署者执行单个命令的别名,例如部署,以root用户身份。使部署者 NOEXEC:。将部署者密码存储在不可见的文件中,例如 .deployconf 具有仅用户访问权限。 400 600 。在 ant 中加载密码,并根据需要使用:


< loadfile srcfile =$ {user.home} /。deployconfproperty =deployconf/>


这与< signjar />但是我没有尝试使用< exec />。可能需要做一些努力才能将换行符放在 .deployconf 之外。


I'm trying to better integrate Eclipse with my build.xml. My build file calls GNU Make for the native portion of the program, and the Makefile uses sudo to movethe compiled libs into system path. Unfortunately that requires entering a password, and Eclipse's terminal doesn't accept user input. So the result from running the build in eclipse is:

 [exec] sudo: no tty present and no askpass program specified
 [exec] make: *** [install] Error 1

Any way around this problem? Can the ant build be elevated to root some other way?

解决方案

Set up a separate account, e.g. deployer. Modify /etc/sudoers to include aliases that allow deployer to execute a single command, e.g. deploy, as root. Make deployer NOEXEC:. Store the deployer password 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"/>

This works well with <signjar/>, but I've not tried it with <exec/>. Some effort may be required to keep linefeeds out of .deployconf.

这篇关于Ant build.xml需要用户输入,但Eclipse没有tty的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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