How to instruct Eclipse to record relative paths of the external jars?

One solution is to not use external jars, but to put your jars into a project, and then use Add Jar(s) instead of Add External Jar(s).

This makes sense from the point of view of source control, you can add/remove dependencies as you need them. It also means that when you update one jar for a separate project, it'll not affect this one.

We've done this in the past, we had a single project which contained all of the jars, which were referred to in the build paths of other projects.

But now we use maven, so we don't need to do that any more.


In eclipse, right-click the project, choose Properties, then Java Build Path, Libraries tab and select "Add Jars"... this will add it with a relative path. "Add External JARs" adds the jar with an absolute path which is not what you want.

Tags:

Eclipse