I have a general question on what is the proper way to manage your compile and deployment jar dependencies. I typically lay out the dev directories like the following for a simple library/application.
Calculator
src
test
build
lib
…
There are many ways to do this, but this is my typical layout for generic projects. My question revolves around the lib directory. I typically place jars that my project is dependent on in the lib directory (log4j, etc.) So at compile time I can set my various paths as lib\log4j.jar or something like that. Now when we create a distributable package, I have tended to mirror this layout.
dist
Calculator.jar
lib
log4j.jar
addition.jar
subtraction.jar
This allows me to either setup a script that sets my classpath relative to where the main jar, or I can setup the classpath in the manifest for the main jar ( Calculator.jar in this case ) This may or may not be the best way to do this, but it has worked for me and seems to be the accepted way of dealing with dependencies by other developers I have talked to about this.
My question comes when I then want to create a new project that makes use of some other project that I have laid out this way.
So let’s say I want to create a new calculator project that uses the Calculator project from the sample above. If I follow the same layout, I would get something like the following:
dist
ScentificCalculator.jar
lib
Calculator.jar
lib
Log4j.jar
addition.jar
subtraction.jar
Of course, this could get out of hand the deeper your dependency tree is:
SuperWhizBangCalculator.jar
lib
ScientificCalculator.jar
lib
Calculator.jar
lib
log4j.jar
addition.jar
subtraction.jar
Another option would be to flatten out the tree:
SuperWhizBangCalculator
lib
ScientificCalculator.jar
Calculator.jar
log4J.jar
addition.jar
subtraction.jar
But something just does not seem right about this. You lose the structure that tells you what libraries go with which component that you are dependent on. So I was wondering if there is a community driven standard way of doing this, with the understanding that there is never a once size fits all.
Thanks for the time...