Folder with jars in project

Piotr Sobczyk picture Piotr Sobczyk · Nov 11, 2011 · Viewed 11.9k times · Source

When I work on small desktop projects I used to create lib folder in my project's root where I keep all project's jar dependencies. Then I use Configure Build Path -> Libraries -> Add JARs... to manually add all jars from this folder to buildpath/classpath. And because Add JARs... (unlike Add external JARs) uses relative paths, the project is portable, what is important for me.

The problem is that each time I add or remove a jar from my lib folder I need to manually add/remove this jar in project buildpath settings (and of course I often forget to do so).

Is there a way to just inform Eclipse that "This is a folder where I keep all of my jars. Please, add all the jars from there automatically to buildpath/classpath"? I tried to treat this folder as a class folder (Add class folder...) but it doesn't work that way :(.

P.S. I know about Maven and Eclipse-Maven integration but I want to keep my small project's simple (Maven integration is sometimes frustrating so I prefer to avoid it in these projects), so please don't suggest this in answer. Also as I mentioned, these are desktop projects, so there is no WEB-INF/lib folder in my project that is usually automatically handled by Java EE plugins.

Answer

aleroot picture aleroot · Dec 2, 2011

you can try with a classpath container, take a look here for an example .

Take a look also at the Apache IvyDE classpath container .

However adding a new library to the classpath is simple and quick as :

Right click on it ---> Build Path ---> Add To Build Path

EDIT

This lightweight plugin should do exactly what you want !