user1607264
user1607264

Reputation: 55

Eclipse buildpath automatically taking all JARs of a linked directory

This issue is a variation on the one described here: Eclipse buildpath automatically taking all JARs of a internal directory

But instead of any local folder, I'd rather have a linked folder from another project be picked up automatically in the buildpath.

Basically, I have a main project in my workspace that holds directories lib, ext-lib that contain multiple jar files each. These jar files may be upgraded/removed or new ones added every few days.

I also have many other projects in the workspace that relay on the exact same (up-to-date) jars from my main project.

My goal is that as I modify the jars in these two folders in my main project, to have them as linked folders in all other projects and have those linked projects dynamically picked up as part of the buildpath of all those projects.

Any suggestion on how to do that in eclipse would be highly appreciated. Unfortunately, the "dynamic directory" plugins people mention can not work with "linked" folders :(

Sincerely, Guy

Upvotes: 1

Views: 1480

Answers (1)

Ashutosh Jindal
Ashutosh Jindal

Reputation: 18869

I would suggest creating a USER LIBRARY in eclipse and then using that in all of your eclipse projects.

Try going into preferences Java -> Build Path -> User Libraries and creating a new user library with all your jars. Then use this everywhere you need these jars.

See this page for more details.

Also, this page explains creating a user library in a bit more detail. There is also a use-case there which seems a bit more aligned to what you had in mind:

6.2.1. Linked Library Project

A useful hybrid strategy is to configure a user library that is also available as a linked folder in your Eclipse workspace. Follow these steps:
1.

Create a simple project in your workspace. Unlike Java projects, a simple project has no Java build path configuration in its properties. Use the command File > New > Project > Simple Project.

2.

Uncheck the option to use a default project location within the workspace folder and enter the path for your \eclipse-contrib\libraries folder (see Figure 6-8).

Upvotes: 1

Related Questions