I am finding that I need to compare a warfiles version, embedded
in it’s name, with the version deployed in a tomcat container.
I can easily write code to parse the version from the filename
and compare it to what I am considering deploying…but I always
need to see if there is a less “cody” and more built-in way to do this.
How are others doing this?
This is another terrible question, but I figure it cannot hurt to try…
Ideally you would already have access to that version number via the node
attributes. Then the value from the attribute can be used to compare
against the value from the exploded war, as you mentioned.
If this is not the case, I would highly recommend changing things. When I
was deploying war/jar files, we used a similar technique to formulate the
download url for the application’s deployable artifact. It was usually
something like ${application_name}-${version_string}.tar.gz. This archive
file was expected to contain an artifact named ${application_name}-${version_string}.war. Setting this kind of
expectation allows you to know when something has changed on the system,
and a corrective action is required.