简体   繁体   English

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

[英]How to use a launch configuration as a template in eclipse

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?有没有办法在 eclipse 中使用启动配置作为“模板”,这样我就可以右键单击包含主类的 java 文件并运行/调试它?

Launch configuration:启动配置:

https://i.stack.imgur.com/tAr1K.png

I want to use this for running tests (we do not use any frameworks like JUnit) which are all in separate java files.我想用它来运行测试(我们不使用任何像 JUnit 这样的框架),它们都在单独的 java 文件中。 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.启动配置主要有不同的环境(特别是设置的环境变量)来控制是否运行带有日志记录/跟踪等的测试。现在,为了使用不同的环境变量运行不同的测试,我必须不断改变主要基于我要运行的测试的类。

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最后它应该是这样的,你可以设置一些属性

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让Eclipse知道启动配置已更改? - How to let Eclipse know that launch configuration was changed? Eclipse RCP:如何导出启动配置插件? - Eclipse RCP: how to export launch configuration plugins? 如何正确结束Eclipse启动配置执行? - How to properly end Eclipse launch configuration execution? 如何使用 Eclipse 创建通用启动配置? - How to create a generic launch configuration with Eclipse? Eclipse插件:如何显示具有自定义启动配置和流程的启动流程控制台? - Eclipse plugin: How to show a ProcessConsole for a launch with a custom launch configuration and process? jar eclipse 启动配置 - 它是什么意思以及如何在我的示例中使用它? - jar eclipse launch configuration - what does it mean and how do i use it in my example? 如何在 eclipse 中设置 ATTR_USE_CLASSPATH_ONLY_JAR 而无需编辑 Java > 8 的启动配置? - How to set ATTR_USE_CLASSPATH_ONLY_JAR in eclipse without editing launch configuration for Java > 8? Eclipse启动现有的启动配置 - Eclipse launch existing launch-configuration 如何在单独的控制台上使用一个配置启动多个Java程序(使用Eclipse) - How to launch multiple Java programs with one configuration on separate consoles (with Eclipse) Eclipse:如何以编程方式执行启动配置? - Eclipse: How can I execute a launch configuration programmatically?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM