一、關於linked resource
eclipse 中的linkded resources 是指存放在項目所在位置以外某個地方的文件或者文件夾;這些特定的資源必須有一個項目作爲他們的父資源。linkded resources可以用來給項目添加某些資源,這些資源因爲某些原因必須被報春到項目以外的某個地方。
你可以使用linked resources來覆蓋在workspace中的其他資源;從而使得一個項目的資源可以出現在另外一個項目中;這意味着,一個地方的改變可以使另外一個地方的資源同時發生改變;刪除一個資源副本,會導致兩個地方的資源同時被刪除。
刪除linked resources不會導致資源從文件系統中刪除,但是刪除linked folder下的資源,則會導致資源從文件系統中被刪除。
二、創建linked resource
1).創建一個linked folder
- In one of the navigation views, right-click the project where you want to create the new folder.
- From the pop-up menu, select New > Folder.
- Specify the name of the folder as it will appear in the workbench. This name can be different from the name of the folder in the file system.
- Click Advanced.
- Check Link to folder in the file system.
- Enter a file system path, or click Browse to select a folder in the file system.
- Click Finish.
To create a linked file, follow the same steps as above, except choose New > File instead of New > Folder in the context menu.
Linked resource locations can also be specified relative to a variable. This makes it easier to share projects containing linked resources with other team members, since it avoids hard-coded absolute file system paths that may vary from one machine to the next.
To define a linked resource relative to a path variable, do the following after step 5 above:
- Click the Variables button.
- In the resulting dialog, select an existing path variable or create a new one.
- If the chosen variable defines the exact path of the linked resource, click OK. Otherwise, click Extend to specify a file or folder below the location described by the path variable, then click OK.
- Click Finish.
Tip: The Window > Preferences > General > Workspace > Linked Resources preference page also allows you to define path variables.
Note that, once you create a linked resource you will not be able to change the link target path that you entered in step 6. or 8. above.
來源:http://blog.csdn.net/wsmyf7958/article/details/1611781