I have a question related to version based compilation for jar files.
I have a jar file called jtools.jar for our application. I want to include all the versions of jtools.jar e.g. jtools_v_2_1.jar, jtools_v_2_2.jar, jtools_v_4_1.jar� into one single server. To make this possible, I need a class path that also includes the version number. For example, instead of having classes:
The question: is there a way in Java language that we can �version� the �import� statements? Example:
we envision to have it in the form of:
Is there a �macro� in the form above (%version%) that we can it be replaced during compilation with let�s say v_2_2? (and compiler could take the �D symbolic definition what indicates version of interest is let�s say v_2_2)?
I will appreciate any suggestions...
Joined: Aug 02, 2004
I would recommend the following...
Keep the package names as they are:
Use a directory structure like the following:
You might want to put the versions even higher up the directory tree.
When you are compiling or running a specific version just ensure that your classpath is pointing to the right files/directory.
I'm not aware of any way to do what you're asking and I don't believe that would be a wise choice in any case.
I concur with Julian. Making the version part of the package name is not a good idea. I create a jar for each version (for example: xyz-4.1.0.jar, xyz-4.1.1.jar and so on), and make sure that the approriate jar is in the classpath for whatever wants to use that version of the facility.