2013年3月7日 星期四

為CloudStack設定更好的Eclipse開發環境


1.       Close eclipse

2.       Make sure your workspace is not stored in the cloudstack directory.  (This may be only my problem because I used to like to do that.)  If your workspace is stored in the directory, you want to delete all eclipse metadata and create the workspace somewhere else. 

3.       Remove the eclipse generated bin directory from all of the directories.  The reason is because CloudStack projects used to use bin as the directory for all the eclipse generated .class files but now with maven based projects, eclipse uses target/classes to store them.  So now eclipse sees the .class files in the bin directories as resources that you own.  That's why there's .class files in the Open Resource directory.

確認你的Eclipse工作環境並不和你Checkout下來的CloudStack目錄重疊(Eclipse對於project所產生的metadata會對git的運作產生問題)

4.       Remove all of the .project files.  This is again because we used to checkin .project files and some of your .project files were not created from maven pom.xml.  If you did this before, then you can skip steps 5-8.

移除所有的.project 檔案

5.       Start Eclipse.

6.       If you deleted your workspace in step 2, then you should create a new workspace.

7.       Remove all of the projects.

8.       Import all maven projects again.

9.       Hit Shift-Ctrl-R to open resource dialogue

10.   Click on the down arrow in the upper right of the dialogue box

11.   Click on the Edit Active Working Set from the drop down menu

12.   Create a working set called cloudstack

13.   Add all of the projects to it and then remove the parent projects.  The reason you want to remove them is because they're parent projects and when you open resource, the open resource dialogue gets the .java file from both the actual project and the parent projects so the same .java file appears more than once.
加入所有的project並移除parent project,這麼做的原因是在於parent project會造成你打開resource時,展開的resource視窗會load java檔兩次

  • Cloudstack-framework
  • Cloud-engine
  • Cloudstack
  • Cloudstack-plugins
  • Cloud-services


14.   Click on finish

15.   Click on the top right drop down button again

16.   Make sure "Show derived resources" is not checked

Another easier way to do this may be to push all your commits and changes and then delete the source directory and reclone the repo.  Then follow just steps 6-16.

After doing that, when you hit Ctrl-Shift-R, make sure the CloudStack working set is selected.  Now only the java file you want will show up.  There's no .class files and no multiple copies of the same java files.

本文轉載自 : Setting up a better eclipse environment....  作者為 : Alex Huang

沒有留言:

張貼留言