如何以编程方式运行 Eclipse 启动配置?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/222093/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:29:39  来源:igfitidea点击:

How to run Eclipse launch configurations programmatically?

eclipsebuild-processeclipse-plugineclipse-pde

提问by jamesh

I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:

我发现很难很好地表达这个问题,因为有很多通用术语(运行、配置、启动等)。开始:

You can save run configurations in a .launchfile. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.

您可以将运行配置保存在.launch文件中。(在“运行配置”对话框中的“通用”选项卡下,另存为共享文件。

We check these in to SVN. The developers can pass them around, and it helps getting new devs running a working application quicker.

我们将这些签入到 SVN。开发人员可以传递它们,这有助于让新开发人员更快地运行工作应用程序。

I'd like to check these out as part of our build and use them to programatically run the application, the tests, etc, without spinning up the whole IDE.

我想将这些作为我们构建的一部分进行检查,并使用它们以编程方式运行应用程序、测试等,而无需启动整个 IDE。

What would be the best way to run a .launchfile outside of the UI?

.launch在 UI 之外运行文件的最佳方式是什么?

Edit: I am trying to unify the tests run on the build server and the IDE. I do not particularly want to give up integrated debugging, which would be the case with an ant script to run the tests .

编辑:我正在尝试统一在构建服务器和 IDE 上运行的测试。我并不特别想放弃集成调试,使用 ant 脚本来运行测试就是这种情况。

This is probably more a problem for integration testing with multiple bundles, or unit testing a whole bundle, where you'd like to mock up extensions.

对于使用多个包进行集成测试,或者对整个包进行单元测试,您可能希望模拟扩展,这可能更像是一个问题。

回答by Adrian Pascalin

there is an eclipse plugin built over JUnit, called TPTP. It provides an automation client which can be used to launch the test from eclipse with no gui. maybe it helps

有一个基于 JUnit 构建的 Eclipse 插件,称为 TPTP。它提供了一个自动化客户端,可用于在没有 gui 的情况下从 Eclipse 启动测试。也许它有帮助

回答by jamesh

Ant4Eclipsemay provide a good starting point on how to do this.

Ant4Eclipse可能为如何执行此操作提供了一个很好的起点。

Unfortunately, this is limited to Java Applications and JUnit configurations; I am more interested in PDE applications and Plugin JUnit tests.

不幸的是,这仅限于 Java 应用程序和 JUnit 配置;我对 PDE 应用程序和插件 JUnit 测试更感兴趣。

回答by James E. Ervin

I have recently had alot of success building an Eclipse RCP app inside a Hudson CI server using Eclipse Buckminster. It took a bit of doing, but once I setup both features, made my RCP product be based on features, and added the Buckminster query files and the like, it worked. There is a Hudson/Jenkins Buckminster plugin that allowed me to have hudson build the application.

我最近使用 Eclipse Buckminster 在 Hudson CI 服务器中构建 Eclipse RCP 应用程序取得了很多成功。这花了一些时间,但是一旦我设置了这两个功能,使我的 RCP 产品基于功能,并添加了 Buckminster 查询文件等,它就起作用了。有一个 Hudson/Jenkins Buckminster 插件可以让我让 hudson 构建应用程序。

After saving the launch configurations for each test fragment, I created hudson commands to invoke them (yes one line per test fragment unfortunately), but after that I got the automated CI build that I wanted.

保存每个测试片段的启动配置后,我创建了 hudson 命令来调用它们(不幸的是,每个测试片段一行),但之后我得到了我想要的自动化 CI 构建。

回答by Peter Tseng

You could also use the shell command Eclipse uses. To get it:

您还可以使用 Eclipse 使用的 shell 命令。为拿到它,为实现它:

  1. Run your program in Eclipse
  2. Go to the "Debug" view
  3. Right-click on the process (probably the second item in the tree) and select "Properties"
  4. Copy shell command and delete the agentlib flag to run in bash
  1. 在 Eclipse 中运行你的程序
  2. 转到“调试”视图
  3. 右键单击进程(可能是树中的第二项)并选择“属性”
  4. 复制shell命令并删除agentlib标志以在bash中运行

回答by Mario Ortegón

I think you don't need to use the .launch configurations to run the tests. If you build an application using the Eclipse Build System, then you can use the AntRunner application from Eclipse to run your units tests. This doesn't start the whole IDE.

我认为您不需要使用 .launch 配置来运行测试。如果您使用 Eclipse 构建系统构建应用程序,那么您可以使用来自 Eclipse 的 AntRunner 应用程序来运行您的单元测试。这不会启动整个 IDE。

This article describes how to run the tests during your build process. With this process, you use a special "Test" Eclipse and load the plugins you want to test.

本文介绍了如何在构建过程中运行测试。通过此过程,您将使用一个特殊的“测试”Eclipse 并加载您想要测试的插件。

回答by Fabian Steeg

Perhaps running the configurations the way you would run your own custom run configurations would help here. It is described in this article.

也许以您运行自己的自定义运行配置的方式运行配置在这里会有所帮助。它在这篇文章中有描述。