Relative Paths in Eclipse
I have an Eclipse workspace that is checked into a Subversion repository. However, if I change the name of the workspace directory, the project files don't load and I have to re-import them, as well as set any workspace related settings again. Does Eclipse work with relative paths? I am not the only team member on this project, and unfortunately the other guy refuses to follow a common directory organization scheme.
EDIT These are all java projects at this point
EDIT There are several files in the workspace matadata folder, though here is the first one I found in relation to the project
<workspace root>\.metadata\plugins\org.eclipse.core.resources\.projects\ProjectName\.locat开发者_Python百科ion
It is in this file ".location" that there is a file based URL. I did some research after Eclipse crashed when I tried to use a relative path and came to the conclusion that relative paths are not possible with URLs.
EDIT Here are the .classpath and .project contents
.CLASSPATH
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
.PROJECT
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>SimpleHelloWorld</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
For purposes of configuration and testing, I have been trying to make this work only with our simple Hello World! sample.
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...
精彩评论