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

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

问题描述

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

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

有什么办法可以解决这个问题?可以通过其他方式将 ant build 提升为 root 吗?

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

推荐答案

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

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"/>

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

这对 很有效,但我没有用 尝试过.可能需要付出一些努力才能将换行符排除在 .deployconf 之外.

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

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