Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Definining user libraries in Eclipse as part of a project and not a workspace

I saw that in Eclipse I can define User Libraries - to make setting the classpath easier (and probably for other reasons as well).

The problem is, that these libraries are only available in the workspace, and if I want other people using the same project to use them - I need to export my user library and they need to import it.

Is there any functionality like this on the project level? I basically need to have a 'classpath group' - can it be done?

If not, is there an automatic way to auto import the user library to the workspace when importing the project?

I'm using Eclipse 3.6.

like image 345
RonK Avatar asked Jun 02 '11 11:06

RonK


People also ask

How do I use user library in Eclipse?

Step 1- Open the Eclipse IDE, click on the Window » Preferences. Step 2- From the Preferences window, click on the Java » Build Path » User Libraries. Step 3- Click on the New button and choose a suitable name for your user library, hit the OK button. Step 4- Your user library has been created.

What are user libraries in Eclipse?

A User Library in EclipseSW can be a useful way to organize a set of jarW files. If you have a set of jar files that you use in several projects, you can create a User Library to reference the set of jar files.

Where are Eclipse libraries stored?

Eclipse does not copy any of the contents of a User Library, it is merely a container with machine-specific absolute paths. The User Library definitions are stored in the workspace; specifically, in . metadata/. plugins/org.


1 Answers

JDT has the 2 concepts, user libraries and classpath variables. In the classpath variable, you can add jars to your project. Other team members have to fill in the variables in their workspace so their classpath is complete. This is useful when external jars might be in different locations on each team members local file system.

The USER_LIBRARY is a container for adding a logical group of local jars all at once. For example, the JRE_LIB container represents a number of local jars. But as you've seen, it points to a local set of jars meant to be used in multiple projects (as the JRE is added to multiple projects).

Aside from export/import (which you're already doing), I don't believe you can check CLASS_LIBRARIES into a project's SCM. If there was, the preference page would have a "Configure Project specific settings" link at the top.

Your best bet is to simply add the jars to the project, so they'll be included in the SCM. If they can be in different locations depending on the rest of your team, then use a classpath variable so it can be set in each workspace. That's the least amount of hassle as far as team members checking out the project and being ready to go.

like image 169
Paul Webster Avatar answered Oct 20 '22 08:10

Paul Webster