如何获取 Eclipse 运行配置的命令行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20891108/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I get the command-line for an Eclipse run configuration?
提问by rob
I have several JUnit run configurations in Eclipse that I need to replicate on the command-line in order to use a third-party analysis tool. So far I've just been writing the command-line manually by looking at the run configuration and writing the appropriate classpath and command-line arguments.
我在 Eclipse 中有几个 JUnit 运行配置,我需要在命令行上复制这些配置以便使用第三方分析工具。到目前为止,我只是通过查看运行配置并编写适当的类路径和命令行参数来手动编写命令行。
Eclipse's run configurations (normal, JUnit, or other) must ultimately boil down to a command-line anyway, so how and where do I find that?
Eclipse 的运行配置(普通、JUnit 或其他)最终必须归结为命令行,那么我如何以及在哪里找到它?
回答by rob
I found a solutionon Stack Overflow for Java program run configurations which also works for JUnit run configurations.
我在 Stack Overflow 上为 Java 程序运行配置找到了一个解决方案,它也适用于 JUnit 运行配置。
You can get the full command executed by your configuration on the Debug tab, or more specifically the Debug view.
- Run your application
- Go to your Debug perspective
- There should be an entry in there (in the Debug View) for the app you've just executed
- Right-click the node which references java.exe or javaw.exe and select Properties In the dialog that pops up you'll see the Command Line which includes all jars, parameters, etc
您可以在“调试”选项卡或更具体地说“调试”视图中获取由您的配置执行的完整命令。
- 运行您的应用程序
- 转到您的调试透视图
- 那里应该有一个条目(在调试视图中)用于您刚刚执行的应用程序
- 右键单击引用 java.exe 或 javaw.exe 的节点并选择 Properties 在弹出的对话框中,您将看到包含所有 jar、参数等的命令行
回答by Dennis S.
You'll find the junit launch commands in .metadata/.plugins/org.eclipse.debug.core/.launches, assuming your Eclipse works like mine does. The files are named {TestClass}.launch.
您将在 .metadata/.plugins/org.eclipse.debug.core/.launches 中找到 junit 启动命令,假设您的 Eclipse 像我的一样工作。这些文件被命名为 {TestClass}.launch。
You will probably also need the .classpath file in the project directory that contains the test class.
您可能还需要包含测试类的项目目录中的 .classpath 文件。
Like the run configurations, they're XML files (even if they don't have an xml extension).
与运行配置一样,它们是 XML 文件(即使它们没有 xml 扩展名)。
回答by Kilian Foth
Scan your workspace .metadata
directory for files called *.launch
. I forget which plugin directory exactly holds these records, but it might even be the most basic org.eclipse.plugins.core
one.
扫描您的工作区.metadata
目录以查找名为*.launch
. 我忘记了哪个插件目录准确保存了这些记录,但它甚至可能是最基本的org.eclipse.plugins.core
。