views:

156

answers:

4

I'm working on a project that is implementing a number Java web applications (and associated JAR files) using Seam.

What is considered best practice with regard to including version information in deployments? What I need to understand is how web applications should contain and publish their versions and how the same can be done for JAR files.

Thanks

+1  A: 

You've got a couple of options when it comes to including the version number:

  1. add it to the JAR's MANIFEST.INF.
  2. include the version of the JAR in the filename.

It's quite common to do both.

Nick Holt
+3  A: 

there are sun specifications and tutorials.

dfa
Just what I was looking for. Thank you very much.
James Watt
A: 

As a Maven user, I follow the Maven conventions and let Maven manage all the versioning, so I end up with wars and jars with names of the form:

foo-core-1.0.0.jar
foo-ui-1.0.0.jar
foo-app-1.1.0.war
...

Maven will also put the version information in the Manifest and embed the POM inside META_INF/maven/[groupId]/[artifactId]/pom.xml so you can determine what the original artifact depended on. This can be handy for manual verification of a live server.

Rich Seller
A: 

Libraries with an official version number often have it embedded in the filename.

For build info, you should have an automated build process anyway, and it most likely uses ant. It is easy to:

  • For jar files, you can set the implementation attributes in the manifest files.
  • You can create a propertyfile located in the classpath which contain the information you wish to propagate. Often you want the build time and who built it.
  • For web applications you can put it in the description located in web.xml.

You can display this information in several ways:

  • The description of a web app is often easily visible in the deployment environment.
  • A build page showing the components used to build.
  • Logging the build information to the servlet log at start up time.

The essential question here is who needs to see it? End users cannot see in logs...

Also do not underestimate the value of an accurately kept deployment log! You should not have to go and look at the consumers files...

Thorbjørn Ravn Andersen