如何在Eclipse中将启动配置用作模板

huangapple go评论64阅读模式
英文:

How to use a launch configuration as a template in eclipse

问题

有没有一种方法可以在Eclipse中使用启动配置作为“模板”,以便我只需右键单击包含主类的Java文件并运行/调试它?

启动配置:

(图片已省略)

我想将其用于运行测试(我们不使用任何像JUnit之类的框架),这些测试都在单独的Java文件中。启动配置主要具有不同的环境(特别是设置的环境变量),以控制是否在日志/跟踪下运行测试等。目前,为了使用不同的环境变量运行不同的测试,我必须根据我想要运行的测试不断更改主类。

英文:

Is there a way to use a launch configuration in eclipse as a "template" such that I can just right click the java file containing the main class and run/debug it?

Launch configuration:

如何在Eclipse中将启动配置用作模板

I want to use this for running tests (we do not use any frameworks like JUnit) which are all in separate java files. The launch configurations mainly have different environments (particularly the environment variables set) to control whether to run the test with logging/tracing on, etc. Right now, in order to run different tests using different environment variables, I have to keep changing the main class based on the test I want to run.

答案1

得分: 1

是的,这是可能的。您可以创建一个原型作为模板。需要以下几个步骤:

  1. 创建原型配置
  2. 创建配置
  3. 选择原型选项卡 + 设置原型
  4. 最后应该看起来像这样,然后您可以设置一些属性

如何在Eclipse中将启动配置用作模板

英文:

Yes it is possible. You can create a prototype as a template. There are several steps necessary:

  1. create a prototype configuration
  2. create a configuration
  3. select the prototype tab + set the prototype
  4. at the end it should look like this and you can set some attributes

如何在Eclipse中将启动配置用作模板

huangapple
  • 本文由 发表于 2020年9月26日 23:37:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/64079509.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定