2

If we are building a large library of java classes, what determines when it is best to split them into separate jar files?

My understanding is that having one large jar file should not significantly affect the JVM performance. However, there is some development cost if an entire suite of lengthy tests are run when changes or additions are made to the jar. Is there a cost or benefit when using large jar files with maven and archiva?

What strategy do people use in practice?

Mike
  • 145
  • 2
  • 8

3 Answers3

4

Take into account change management aspects only, the rest is negligible. Jar file is something that determines minimum easily-releasable unit.

Perception
  • 79,279
  • 19
  • 185
  • 195
bobah
  • 18,364
  • 2
  • 37
  • 70
1

We like to split our jars up into smaller, more manageable units. Each jar is specific for doing a subset of tasks. When we develop an application, we'll pull into it only the jars it needs, rather than one large jar that has everything.

We have jars for security, UI, general structures and interfaces, localization, and a bunch of other things that are specific for our industry.

Tony
  • 1,401
  • 9
  • 11
0

Logically separate layers of jar projects, without cyclic dependencies, one layer only depending on preceding layers.

As you can (besides the project name) give a descriptive name being listed in the IDE, one way to keep projects ordered is with abbreviation and numeric prefix:

  • CD01 baselib
  • CD10 mathlib
  • CD30 daolib
  • CD91 xysite
Joop Eggen
  • 107,315
  • 7
  • 83
  • 138