Eclipse External Tools配置

外部工具可用workbench来配置和运行 程序、批处理文件、ant构建文件等。外部工具的输出显示在控制台视图中。
在配置外部工具时可使用如下变量:
${workspace_loc}:
workspace的绝对路径
${workspace_loc:}:
所指定的resource的绝对路径。resource path是相对于workspace root的完整路径。
注意:${workspace_loc:/myproject/myfile.txt}和${workspace_loc}/myproject/myfile.txt不一定相同,因为前者表示的myfile.txt可能位于workspace之外。
${project_loc}:
当前所选择的resource所在的project或正构建的project或所选择的的绝对路径
${project_loc:}:
所指定的resource所在的project的绝对路径。resource path是相对于workspace root的相对路径。
${project_path}
当前选择的资源所在的project或者正构建的project的相对于workspace root的相对路径。
${project_name}
当前选择的资源所在的project或者正构建的project的名称
${container_loc}:
当前所选择的资源的parent的绝对路径
${container_loc:}
所指定的resource的parent的绝对路径
${resource_loc}
当前选定的资源的绝对路径
${resource_loc:}
所指定的资源的绝对路径
${container_path}
当前选定的资源的parent的相对于workspace root的路径
${resource_path}
当前选定的资源的相对于workspace root的路径
${container_name}
当前选定的资源的parent的名称
${resource_name}
当前选定的资源的名称
${build_type}
在外部工具作为构建的一部分时表示构建的类型。值可以是“full”、“incremental”、“auto”。如果外部工具运行于构建之外,值为“none”
假设workspace目录为c:\eclipse\workspace
有两个project:MyProject1和MyProject2
MyProject1位于workspace之内。
MyProject2位于workspace目录之外:c:\projects\MyProject2。
选中资源/MyProject2/MyFolder/MyFile.txt,则运行外部工具时,各对应变量值如下:
Variable Examples Expanded Results
${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
[整理自网络]

此条目发表在java/j2ee分类目录,贴了标签。将固定链接加入收藏夹。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据