英文:
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:
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
是的,这是可能的。您可以创建一个原型作为模板。需要以下几个步骤:
- 创建原型配置
- 创建配置
- 选择原型选项卡 + 设置原型
- 最后应该看起来像这样,然后您可以设置一些属性
英文:
Yes it is possible. You can create a prototype as a template. There are several steps necessary:
- create a prototype configuration
- create a configuration
- select the prototype tab + set the prototype
- at the end it should look like this and you can set some attributes
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论