eclipse的項目和配置文件 .project .cproject .classpath .metadata
轉載自:http://www.cnblogs.com/shangdawei/p/3457413.htmleclipse CDT建立project后在project name對應的目錄下面會生成.project和.cproject兩個隱藏文件。
eclipse java建立project后在project name對應的目錄下面會生成.project和.classpath兩個隱藏文件。
.project文件大小2~3K Bytes , 該文件是針對eclipse的project Description ,
.cproject文件大小是10~12K Bytes,該文件是針對CDT插件的project Description ,
.classpath文件大小有1~3 M Bytes , 該文件是針對java插件的project Description,
.project和 .cproject , .classpath都是XML文件格式。
.project和 .cproject , .classpath 存在于project name對應的目錄下,
.metadata是一個隱藏文件夾,它存在于eclipse第一次啟動時指定的workspace目錄下,
project name 和 workspace 分別對應的目錄不能是同一個目錄,否則無法建立project name。
當把project name( project name實際上就是直接產生.project) 建立在已存在source code 的目錄時,
即表示該project name代表的project自動包含該目錄下的所有source code。
eclipse cdt 的索引數據庫文件名后綴是.pdom ,保存在.metadata/.plugins/org.eclipse.cdt.core目錄下,
比如kernel_0715.1316773656364.pdom , uboot-0715.1316772863625.pdom ,其大小很可觀,從幾十M 到幾百M ,甚至1G Bytes。
索引數據庫文件名格式一般是 [Project-Name].[Random-Number].pdom。
eclipse java 的index 數據庫在.metadata/.plugins/org.eclipse.jdt.core目錄下,和eclipse cdt不同,這個目錄下索引文件太多了。
對一個 Workspace 配置的備份其實就是備份 Workspace 的配置目錄 .metadata。
eclipse-java 在Project > Properties > Java Build Path > source下增減項目中的文件夾
今天下午遇到一個問題,Eclipse在某一個Workspace上啟動CPU占用率就會是100%,
我懷疑是前兩天反編譯生成的一個源代碼工程錯誤太多導致,
所以想在workspace里找到工程的配置文件然后把它刪除。 經過一番嘗試后發現它存在:
d:\workspace\.metadata\.plugins\org.eclipse.core.resources\.projects
下面。 把想要去掉的工程在這里面刪除就可以了,這樣workspace又可以正常啟動了。
昨天重裝下機器,由于Eclipse里面的設置讓我改的亂七八糟。提示功能沒有了,快捷鍵也給改錯了(可以使用,使用后必須按下方向鍵向左箭頭),而我又不知道怎么把他改回來。
重裝系統后,安裝Eclipse,然后按照找來的文章改快捷鍵,發現快捷鍵已經被改過了?!!!!Why?思考過后,發現,除了每次裝Eclipse后第一次開啟Eclipse時指定的文件夾一樣外,其他都不一樣,那好,就在那個文件夾找原因。不管是學校還是家里,Eclipse指定文件夾內肯定會有一個.metadata文件夾,那可能就是我想找到的原因。把這個文件夾里所有內容刪掉(先關Eclipse),然后再重新啟動Eclipse后發現,所有配置都被還原成默認,Eclipse中項目表也沒有任何項目,哈,看來Eclipse內所有改動都放在這個文件夾。又學了一手,按照上一篇文章修改快捷鍵后,運行正常。OK。
以后Eclipse再有問題,可以直接把.metadata文件夾刪除了,在進行修改。回來再研究研究這個文件夾保存的一些相關文件都是什么。
Eclipse:如何在不同的 workspace 使用相同設定
在 Eclipse 中我們可以透過切換 workspace 來區分不同的工作,
但又只保留一份 Eclipse 的程式以節省空間。
不過也因為 workspace 的設定檔是分開的,
所以當我們新增一個workspace時,常常會發現字型、排版等也都跑掉了,
如果要一一重設非常麻煩,那麼要怎麼樣才能在不同的 workspace 使用相同設定呢?
請見以下流程。
步驟很簡單,條列如下:
- 關掉 Eclipse
- 找到舊的 workspace 的設定檔資料夾,路徑在:${old_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings
- 複製整個資料夾,在新的 workspace 貼上並覆蓋,路徑在:${new_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings
- 啟動 Eclipse 並切換至新 workspace,設定是不是都回來了呢?
Sharing eclipse specific settings across workspaces:
- Go t
${old_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings
- Copy everything under the above directory to
${new_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings
This is going to make sure that the ${new_workspace}
is having the same configuration as the ${old_workspace}
Hope this helps. Update in case of any issues.
Another option is export/import:
- From your existing workspace,
File->Export...->General->Preferences
, check Export all, and choose file to save them to (prefs.epf for example) - Startup Eclipse in a new workspace,
File->Import...->General->Preferences
, choose your file (prefs.epf), check import all
That worked great for the original author of this tip: he had his code formatting, code style, svn repos, jres preferences imported.
Edit: On Eclipse Juno this works poorly. Some preferences silently do not carry over such as save actions.
Clean out Eclipse workspace metadata
http://stackoverflow.com/questions/11768106/clean-out-eclipse-workspace-metadata
There is no easy way to remove the "outdated" stuff from an existing workspace.
Using the "clean" parameter will not really help, as many of the files you refer to are "free form data",
only known to the plugins that are no longer available.
Your best bet is to optimize the re-import, where I would like to point out the following:
- When creating a new workspace, you can already choose to have some settings being copied from the current to the new workspace.
- You can export the preferences of the current workspace (using the Export menu) and re-import them in the new workspace.
- There are lots of recommendations on the Internet to just copy the
${old_workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings
folder from the old to the new workspace.
This is surely the fastest way, but it may lead to weird behaviour, because some of your plugins may depend on these settings
and on some of the mentioned "free form data" stored elsewhere.
(There are even people symlinking these folders over multiple workspaces, but this really requires to use the same plugins on all workspaces.) - You may want to consider using more project specific settings than workspace preferences in the future.
So for instance all the Java compiler settings can either be set on the workspace level or on the project level.
If set on the project level, you can put them under version control and are independent of the workspace.