frankadelic
frankadelic

Reputation: 20803

How to handle Eclipse build path in a team, where local workspace paths are different?

A colleague has checked in an Eclipse project.

All their classpath .jar references point to a workspace specific to their machine:

c:\joesworkspace\myproj1\lib\somejar.jar

I am using a different workspace, so the references are all broken.

I could create my own references pointing to the correct path on my machine, but then it would break references for my colleague when I check in.

An alternative would be to duplicate my colleague's directory structure, but I'd prefer not to do that either.

What's the best way to handle this?

Upvotes: 1

Views: 135

Answers (2)

Ben Vitale
Ben Vitale

Reputation: 1794

If the JAR files are contained within the project, they should be adding the JAR references as relative instead of absolute. That is, on the properties of the project, choose Add JARs instead of Add External JARs.

If the JAR files are not contained within the project, then, well, put 'em in the project. That'll make it more portable (to other workspaces).

Upvotes: 0

dunni
dunni

Reputation: 44515

You could use an environment variable, that points to the workspace or the project as top level path. All paths under that path have to be equal though.

Or you could use a dependency management software like Maven (which i would consider as the best solution).

Upvotes: 1

Related Questions