eclipse eclipse中预定义的变量是什么?

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

What are the predefined variables in eclipse?

eclipseeclipse-luna

提问by merours

With eclipse, I know how to use variables in my launch configurations. I also know there exist a set of predefined variables such as ECLIPSE_HOMEor WORKSPACE_LOC.

使用 eclipse,我知道如何在启动配置中使用变量。我也知道存在一组预定义的变量,例如ECLIPSE_HOMEWORKSPACE_LOC

What I don't know is the extensive list of these predefined variables (ie : variables names and values). Is there such a resource ?

我不知道的是这些预定义变量的广泛列表(即:变量名称和值)。有这样的资源吗?

回答by Wei

I found a very good example about path variables in eclipse help documentation: workbench user guide-concepts-ant & external tools

我在eclipse帮助文档中找到了一个关于路径变量的很好的例子:workbench user guide-concepts-ant & external tools

Lets assume your Eclipse workspace directory is c:\eclipse\workspace and you have two projects, MyProject1 and MyProject2. The first project, MyProject1, is located inside the workspace directory, the second project, MyProject2, is located outside the workspace directory at c:\projects\MyProject2. Lets look at how the variable examples below will be expanded when an external tool is run, if the resource /MyProject2/MyFolder/MyFile.txt is selected.

让我们假设您的 Eclipse 工作区目录是 c:\eclipse\workspace,并且您有两个项目,MyProject1 和 MyProject2。第一个项目 MyProject1 位于工作区目录内,第二个项目 MyProject2 位于工作区目录之外的 c:\projects\MyProject2。如果选择了资源 /MyProject2/MyFolder/MyFile.txt,让我们看看在运行外部工具时如何扩展下面的变量示例。

Variable Example

变量示例

Expanded Results

扩展结果

<p>

    ${workspace_loc}c:\eclipse\workspace
    ${workspace_loc:/MyProject1/MyFile.txt}c:\eclipse\workspace\MyProject\MyFile.txt
    ${workspace_loc:/MyProject2/MyFile.txt} c:\projects\MyProject2\MyFile.txt
    ${project_loc}  c:\projects\MyProject2
    ${project_loc:/MyProject1/MyFile.txt}   c:\eclipse\workspace\MyProject
    ${container_loc}    c:\projects\MyProject2\MyFolder
    ${resource_loc} c:\projects\MyProject2\MyFile.txt
    ${project_path} /MyProject2
    ${container_path}   /MyProject2/MyFolder
    ${resource_path}    /MyProject2/MyFolder/MyFile.txt
    ${project_name} MyProject2
    ${container_name}   MyFolder
    ${resource_name}    MyFile.txt
    ${build_type}   none

</p>

回答by Aaron Digulla

Open the preferences and search for "Classpath Variables".

打开首选项并搜索“类路径变量”。

回答by greg-449

If you mean variables specified in things like the 'Location' field in the launch configuration then clicking the 'Variables...' button next to the field shows you a complete list of the currently defined variables.

如果您指的是在启动配置中的“位置”字段中指定的变量,则单击该字段旁边的“变量...”按钮会显示当前定义变量的完整列表。

Since plugins can add new variables to this list it isn't really possible to give a definitive list as it depends on which plugins you have installed.

由于插件可以向此列表中添加新变量,因此无法给出明确的列表,因为这取决于您安装了哪些插件。

回答by Daniel

${workspace_loc}

${workspace_loc}

and

${ProjDirPath}

${ProjDirPath}

worked for me in Eclipse Oxygen.

在 Eclipse Oxygen 对我来说有效。