Ant build.xml需要用户输入,但Eclipse没有tty
我正在尝试将 Eclipse 与我的 build.xml 更好地集成。 我的构建文件为程序的本机部分调用 GNU Make,并且 Makefile 使用 sudo 将编译的库移动到系统路径中。 不幸的是,这需要输入密码,并且 Eclipse 的终端不接受用户输入。 所以在 eclipse 中运行构建的结果是:
[exec] sudo: no tty present and no askpass program specified
[exec] make: *** [install] Error 1
有什么办法解决这个问题吗?可以通过其他方式将 ant 构建提升为 root 吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以设置 /etc/sudoers 文件,以便为运行 Eclipse 的用户以及用于移动库的命令指定 NOPASSWD: 。使用 visudo 命令,您可以将其添加到 /etc/sudoers 的末尾:
请注意,这确实会带来安全风险,因为 eclipseuser 将有权覆盖系统上的任何文件。
You could set up your /etc/sudoers file so that it specifies NOPASSWD: for the user under which Eclipse is running, and for the command you're using to move the libs. Using the visudo command, you could add this to the end of /etc/sudoers:
Be aware that this does present a security risk as the eclipseuser would then have the power to overwrite any file on the system.
设置一个单独的帐户,例如deployer。修改
/etc/sudoers
以包含以下别名允许部署者以root身份执行单个命令,例如deploy。创建部署程序NOEXEC:
。将部署者密码存储在不可见文件中,例如仅具有用户访问权限的.deployconf:例如400
或600
。在ant
中加载密码,并根据需要使用:这与配合得很好,但我还没有尝试过与一起使用。可能需要付出一些努力才能将换行符排除在 .deployconf 之外。
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 deployerNOEXEC:
. Store the deployer password in an invisible file, e.g. .deployconf having user-only access: e.g.400
or600
. Load the password inant
, and use as required:This works well with <signjar/>, but I've not tried it with <exec/>. Some effort may be required to keep linefeeds out of .deployconf.
也许是一个愚蠢的“解决方案”,但为什么不将部署作为一个单独的步骤呢?让构建创建一个打包工件:DEP、RPM 或其他东西。
Perhaps a stupid 'solution', but why not make the deploy a separate step? Have the build make an packaging artifact: DEP, RPM or something.