Eclipse 和 dropbox 冲突的问题

把workspace建在dropbox想让它自动同步,避免工作丢失。结果dropbox每次开机都要把所有文件check一遍,然后eclipse就老是启动不起来。而且workspace在dropbox不知道为什么还用不了google app engine里面和网络有关的文件夹war里面的web设置文件全部不见了,project一直报错。结果把workspace移到别的地方就完全好了。在国外网站上找到了可能的原因,如下。

I actually Googled around first, and several people have tried putting an Eclipse workspace into Dropbox, but encountered a couple of problems:

  • The additional hidden metadata Dropbox stores to keep track of changes and past version can grow out of hand pretty quickly on the binaries compiled by Eclipse. Also the network traffic ends up being very high. That’s on top of the space required for the binaries themselves, which could be critical if you’re using a free account.
  • You can’t have some projects shared via Dropbox while others are local (e.g. work projects reside only on my work computer, personal projects are shared). You can switch workspaces, of course, but that’s a pain

The solution is to, for a given project, sync only the source files. Now, this does have the disadvantage that it requires a certain amount of setup on each computer that will be accessing the Eclipse project, but it lacks the problems above (and the first one can apparently be crippling).

  1. Create a directory for source files in your Dropbox folder. Something like “Dropbox\MyProject\source”
  2. Run New Java Project in Eclipse. Use your default workspace location. Make sure you have “Create separate folders for sources and class files”. Click Next (not Finish)
  3. Right-click that “src” file and choose “Remove from Build Path”. Then click the “Link Additional Source” (under Details, or the leftmost button fo the right-hand group at the top), and pick the source folder you created in your Dropbox. Go to the Libraries tab and add whatever libraries you need. The jars for user libraries shold probably be in your Dropbox too, just so you have them available.
  4. click Finish.

Now you can create classes, build (and the binaries will be in your local workspace), etc. The only files that will be synced will be your source code, which will save on bandwidth and space.

On another computer, you can boot up Eclipse, and create the Java project, using the Link Additional Source option again. You’ll find that if you make changes on one computer, you’ll probably have to Refresh the project and do a fresh build when you switch to the other computer, but that isn’t all that onerous.

Of course, technically you should be using real source control (Git, CVS, Subversion). But free hosting for a private project is hard to find, setting up a repository on your home box and then making it remotely accessible is a pain, and you have to do explicit commits and checkouts every time you switch computers. Plus good practice dictates that your project should at a minimum be in a buildable state every time you commit, which may not be possible if you haven’t tracked down that stray error at the end of the day… So with Dropbox you can work privately on multiple computers, set up a private source control repository at home and use proper SCC practices. Win-win.

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值