Very cool question! Well, one of my favorite topics, anyhow. I got so excited when I first grokked this stuff I wrote
THIS about it.
Building jars from package structures is pretty mechanical. With
ANT or your
IDE or even by hand you select which directories you build into which jar. Frankly I've only done it with ANT. How do you plan to build your deployments?
Putting interfaces in one jar and implementation in another jar is neat when the implementations might change. One part of your system declares stable interfaces that other parts must implement to play along. This is how you build plug-in behavior. Think about how Sun defined the
JDBC interfaces in the Java libraries and different database vendors wrote implementations. You can plug Oracle or DB2 or MySQL or many others into your application because they all wrote to the interfaces. (Not the interfaces we use to write apps ... there is another set that driver writers must use.)
So the steps: 1) Write interfaces in the stable component, 2) Write implementation in pluggable components, 3) Build a jar per component, and 4) set the classpath to include the jars at runtime.
I don't know if that answered your question because it actually seemed like you had it down pretty well. Let us know if you have specific problems getting it all built.
(BTW: Some might debate jar == group of packages == component. It certainly doesn't have to, but it works ok with
this definition of component.)
[ March 05, 2005: Message edited by: Stan James ]