如何在 Eclipse 中从命令行打开并运行特定脚本
我试图每天同时运行一个自动化套件,所以我想创建一个任务来打开 eclipse 并每天执行主脚本。有没有办法从命令行执行此操作?
I am trying to run an automated suite every day at the same time, so I want to create a task to open eclipse and execute the main script every day. Is there a way to do this from the command line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要使用 eclipse,而是使用专用的软件 - 为其创建持续集成服务器。检查此类标题,例如:hudson、cruiseControl、TeamCity
Instead of using eclipse for it, use a software that is dedicated for it - continous integration servers are created for it. Check such titles like: hudson, cruiseControl, TeamCity
你走错了路。与其尝试自动打开 Eclipse、执行 main...打破 IDE 依赖关系,不如使用 Ant< 编写可移植构建脚本/a> 或 Maven 并在 IDE 外部执行该构建脚本(使用简单的 cron 作业或更复杂的东西(例如持续集成工具),但我不确定您现在是否需要 CI 工具,请从构建脚本开始)。
You are on the wrong path. Instead of trying to automate opening eclipse, executing a main... break the IDE dependency, write a portable build script using Ant or Maven and execute that build script outside the IDE (using a simple cron job or something more elaborated like a Continuous Integration tool but I'm not sure you need a CI tool for now, start with the build script).
所以我假设您想要自动化从 Eclipse 内部运行的某些内容。如果是构建,那么我和其他人一样使用构建脚本,而 CI 是最佳选择。
但万一这不是那个用例...
现在,如果您使用“运行..”对话框来执行此操作,您实际上可以获得 eclipse 用于执行的命令行路径、二进制文件和参数。
您要做的就是打开调试视角。然后按照平常的方式运行脚本。
此时您的进程应该出现在“调试视图”中。
在进程运行时或终止后,右键单击该进程并打开属性。 (您可能需要单击树中的下一级才能获得此选项)
在进程信息下,其中有一个“命令行”部分。这是 eclipse 在幕后执行运行的确切命令行。
您应该能够将其放入脚本(.bat for windows / sh for *nix)并相应地安排。
编辑:添加假设,更改为使用属性屏幕上的流程信息术语。
So I am assuming that you want to automate something that you run from inside eclipse. if it's a build then I'm with the other guys that using a build script and CI is the way to go.
But in case it's not that use case...
Now, if you are using the "Run.." dialogs to do this you can actually get the command line paths, binaries and arguments that eclipse used to execute.
What you do is open up the debug perspective. Then run your script however you normally do.
Your Process should appear in the "Debug View" at this point.
Either while the process is running or after termination, right click on the process and open up the properties. (you may need to click 1 level down in the tree to get this option)
Under process info, inside of that there is a section "Command Line". This is the exact command line that eclipse executed behind the scenes to run.
you should be able to put this into a script (.bat for windows / sh for *nix) and schedule accordingly.
edit: added in assumptions, changed to use process info terms which is what is on the properties screen.