views:

22

answers:

2

This is not about how to add libraries to my project or module dependencies; it's about where to store the .jar files that are referenced by the project/module settings.

Should I have a lib folder in each project, containing the third-party libraries; or should I store them elsewhere on my hard drive? What scheme has worked for you?

A: 

I always have lib-folder under the project, where I put the libraries as you described. It's also good to have the full version number in the library file names. Usually I place the sources and documentation there as well:

lib/
     somelib_1_1_3.jar
     somelib_1_1_3-src.jar
     somelib_1_1_3-doc.jar

This has worked well for me.

msell
What about libraries that are used by multiple modules within a project?
David
+1  A: 

I would recommend you take a look at Maven 2, its a build tool which among other things manages your dependencies for you, and has tight integration with various IDE's including IntelliJ. You have a local repository on your PC into which Maven downloads copies of libraries/source/javadoc from a central repository. There is a getting started tutorial here.

The reason I'm recommending this is that you don't need to worry where things are stored, and everything is loaded into your IDE automatically, but the actual storage is efficient because you only ever have one copy of a particular library on disk.

Jon Freedman