Relative Paths in Eclipse

帅比萌擦擦* 提交于 2019-12-05 19:30:16

The workspace was never really meant to go in source control. Maybe I misunderstood your setup but if you are trying to commit the .metadata folder of your workspace in source control you are heading for a heap of trouble !

Instead of putting your workspace in source control you should only place the project themselves. Then through the Subversive or other subversion plugins, get the project from the SCM. This will have eclipse create automatically all the resources and configurations for your projects for you and they should compile right out of the box provided you have all the dependencies.

Why do you feel the need to have the whole metadata folder in source control to begin with ?

If you are looking for a simple way to manage the build then I suggest you look into Ant, Maven or other such tools to help you out. If you want to preserve your settings most of them have an export functionality, I suggest you get a special project to store these settings and place it under source control, not ideal because it is not automated but once they are setup they should not change all that often. Normally I even filter out the .settings folder and .classpath from my projects before pushing them to SCM and let eclipse and the maven plugin regenerate them for me as needed. Thus far I never really had any trouble getting my stuff back from SCM. Setting up a new sation is a bit longer but with a reference Eclipse installation with all the plugins then importing the configs and projects is really quick.

Eclipse does normally work with relative paths. In my workplace we use a Subversion Repository with the Subversive plugin. When we do a fresh import we don't have any problems for compilation.

You may want to edit the .project and .classpath files of your project to see if there is a reference to an absolute location and change it to be a relative one.

It does not look like Eclipse can do everything with relative paths. One cheap thing you can do is setup an identical preconfigured Eclipse in the same path on different machines. In the future cloud IDEs like Eclipse Orion may solve such issues...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!