tags:

views:

253

answers:

3

Do you follow any design guidelines in java packaging?

is proper packaging is part of the design skill? are there any document about it?

Edit : How packages has to depend on each other?, is cyclic packages unavoidable?, not about jar or war files.

+1  A: 

Packaging is normally about release management, and the general guidelines are:

  • consistency: when you are releasing into integration, pre-production or production environment several deliveries, you want them organized (or "packaged") exactly the same way

  • small number of files: when you have to copy a set of files from one environment to another, you want to copy as many as possible, if their number is reasonable (10-20 max per component to deliver), you can just copy them (even if those files are important in size)

So you want to define a common structure for each delivery like:

aDelivery/
    lib // all jar, ear, war, ...
    bin // all scripts used to launch your application: sh, bat, ant files, ...
    config // all properties files, config files
    src // all sources zipped into jars
    docs // javadoc zipped 
    ...

Plus, all those common directory structures should be stored into one common repository (a VCS, or a maven repo, or...), in order to be queried, without having to rebuilt them every time you need them (you do not need that if you have only one or two delivery components, but when you have 40 to 60 of them... a full rebuilt is out of the question).

VonC
A: 

The problem with packaging in Java is that it has very little relation to what you would like to do. For example, I like following the Eclipse convention of having packages marked internal, but then I can't define their classes with a "package" protection level.

Uri