为所有启动器在Eclipse工作区级别设置环境变量吗? [英] Set Environment Variable At Eclipse workspace level for all launchers?

查看:86
本文介绍了为所有启动器在Eclipse工作区级别设置环境变量吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以设置一个工作区范围的设置来向该工作区中将来创建的所有启动器添加一个环境变量吗?

Can I set a workspace wide setting to add an environment variable to all future launchers created in the workspace?

用例


  • 我们的单元测试需要一个环境变量来将测试引导到某些资源。

  • 变量随我们产品的每个版本

选项
-使用环境变量$修改每个junit启动器b $ b-创建设置变量并启动Eclipse的启动脚本
-全局设置

Options - modify each junit launcher with the environment variable - create start up script that sets variable and launches eclipse - set globally

理想情况下,我想为用户提供一种设置方法

Ideally, I'd like to provide a way for users to set it once per workspace.

日食是否有地方为所有启动器设置环境变量?

Does eclipse have a place to set an environment variable for all launchers?

谢谢

Peter

推荐答案

我能想到的唯一选项是相似的您可以在其中创建多个Shell脚本(linux)或批处理文件(windows)并在此处进行设置。对于前-

Only option which I can think of is similar to yours where you can create multiple shell scripts(linux) or batch files(windows) and set it up there. for ex -

我给出了Windows环境的示例,Linux也可以这样做-

I am giving examples for windows environment and same can be done for Linux as well -

对于Windows-

eclipse.exe -DvariableName1=value1 -DvariableName2=value2

要将不同的变量传递到不同的工作区时,也可以将工作区的位置作为参数的一部分传递。

As you want to pass different variables to different workspaces, you can also pass location of your workspace as part of arguments.

eclipse.exe -data <your_workspace_location> -DvariableName1=value1 -DvariableName2=value2

您可以在Windows和地方创建eclipse.exe的多个快捷方式如果需要,可以将它们放在桌面上(以便快速访问)。每个快捷方式都可能指向上述命令的类似变体,但具有不同的工作空间和变量。

You can create multiple shortcuts of eclipse.exe in windows and place them on Desktop (for quick access) if needed. Each shortcut may point to a similar variant of above command with different workspace and different variables.

希望这会有所帮助。快乐的编码:)

Hope this helps. Happy coding :)

这篇关于为所有启动器在Eclipse工作区级别设置环境变量吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆