Separate Jars
When creating JAR files, I've always kept the source separate and offered it as an optional extra.
eg:
- Foo.jar
- Foo-source.jar
It seems to be the obvious way to do things and is very common. Advantages being:
- Keeps binary jar small
- Source may not be open / public
- Faster for classloader? (I've no idea, just guessing)
Single Jar
I've started to doubt whether these advantages are always worth it. I'm working on a tiny component that is open-source. None of the advantages I've listed above were problems in this project anyway:
- Classes + source still trivially small (and will remain that way)
- Source is open
- Class loading speed of this jar is irrelevant
Keeping the source with the classes does however bring new advantages:
- Single dependency
- No issues of version mismatch between source and classes
- Developers using this jar will always have the source to hand (to debug or inspect)
Those new advantages are really attractive to me. Yes, I could just zip source, classes and even javadoc into a zip file and let clients of my component decide which they want to use (like Google do with the guava libraries) but is it really worth it?
I know it goes against conventional software engineering logic a little, but I think the advantages of a single jar file out-weigh the alternatives.
Am I wrong? Is there a better way?