Enhanced version.sh and version.bat Output#919
Open
csutherl wants to merge 1 commit intoapache:mainfrom
Open
Conversation
michael-o
reviewed
Nov 13, 2025
cea11af to
6c55a57
Compare
Member
Author
|
Force pushed to fix checkstyle failings since validate is off by default :( |
csutherl
commented
Nov 13, 2025
csutherl
commented
Nov 13, 2025
csutherl
commented
Nov 13, 2025
6c55a57 to
373d292
Compare
…d third-party library versions
373d292 to
09cb310
Compare
Member
Author
|
I updated the third-party JAR scanning to improve success of getting a version number in the output by parsing the filename, and included some tests for that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change Summary
This changeset enhances the output
version.shandversion.batto display comprehensive dependency and library version information that is available to tomcat for use (read: not configured in the server.xml), making it easier to verify which versions are available without the potentially costly action of grepping the logs after the fact. The update allows a single command to retrieve all the important version information a user may need without starting tomcat. The output is also an automation friendly parseable output for scripts and monitoring tools, and allows for a quick inventory of libraries that could be used by the instance.I've added six public methods total across three classes to expose version info and reduce the need for as much reflection, introduced 14 new tests which covers all of the changes in ServerInfo, and ensured that the change is compatible with Java 8+ and ready for backporting all the way to Tomcat 9.0.x with no changes required.
Files Modified
bin/catalina.shandbin/catalina.batversioncommand to include:tomcat-juli.jar(for logging support)$CATALINA_HOME/lib/*(for APR/FFM classes)-Dcatalina.homeand-Dcatalina.basesystem properties to have access to third-party jarsversioncommand, not normal startupjava/org/apache/catalina/core/AprLifecycleListener.javagetInstalledTcnVersion()- Returns Tomcat Native version stringgetInstalledAprVersion()- Returns APR version stringgetInstalledOpenSslVersion()- Returns OpenSSL version string (via APR)getTcnVersionWarning()- Returns version warning if installed version is outdatedjava/org/apache/catalina/core/OpenSSLLifecycleListener.javagetInstalledOpenSslVersion()to expose FFM OpenSSL versionOpenSSLLibrary.getVersionString()for native version string to avoid compile time depsjava/org/apache/tomcat/util/net/openssl/panama/OpenSSLLibrary.javagetVersionString()to expose native OpenSSL version stringjava/org/apache/catalina/util/ServerInfo.javagetConstructor().newInstance()instead of Java 9+getDeclaredConstructor()for Java 8 compattest/org/apache/catalina/util/TestServerInfo.javaisTomcatCoreJar())getJarVersion())captureServerInfoOutput()to eliminate test code duplicationConsumer<Manifest>for test JAR creation (Java 8 compatible)Assume.assumeTrue()to skip gracefully when native libraries unavailablewebapps/docs/changelog.xmlExample Output
Before:
After:
New Information in Output
APR and Tomcat Native Detection (when available)
FFM OpenSSL Detection (when available)
Third-Party Libraries
lib/