java.lang.Object
ch.qos.logback.core.util.VersionUtil
Utility class for handling and validating version information of various artifacts.
It is used by logback-classic, logback-access-common, logback-access-jetty11, logback-access-tomcat, etc. to alert users about version discrepancies between depender and dependency artifacts.
- Since:
- 1.5.25
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVersionUtil(Context context) Instance methods allow for polymorphism, static methods do not. -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidaddFoundVersionStatus(Context context, String name, String version) static voidcheckForVersionEquality(Context context, String dependerVersion, String dependencyVersion, String dependerName, String dependencyName) Compares the versions of a depender and a dependency to determine if they are equal.voidcompareExpectedAndFoundVersion(String actualDependencyVersion, Class<?> dependerClass, String dependerVersion, String dependerName, String dependencyName) Compares the expected version of a dependency with the actual version found and updates the status context.protected StringgetExpectedVersionOfDependencyByProperties(Class<?> dependerClass, String propertiesFileName, String dependencyNameAsKey) static StringgetVersionOfArtifact(Class<?> aClass) Deprecated.protected static Stringstatic String
-
Constructor Details
-
VersionUtil
Instance methods allow for polymorphism, static methods do not.- Parameters:
context-- Since:
- 1.5.30
-
-
Method Details
-
getVersionOfArtifact
Deprecated.Retrieves the version of an artifact, such as logback-core.jar, logback-access-common.jar etc.The aClass parameter is assumed to be part of the artifact.
The method first attempts to get the version from the module information. If the module version is not available, it falls back to retrieving the implementation version from the package.
- Parameters:
aClass- the class from which to retrieve the version information- Returns:
- the version of the artifact where aClass is found, or null if the version cannot be determined
-
nonNull
-
getExpectedVersionOfDependencyByProperties
protected String getExpectedVersionOfDependencyByProperties(Class<?> dependerClass, String propertiesFileName, String dependencyNameAsKey) -
checkForVersionEquality
public static void checkForVersionEquality(Context context, String dependerVersion, String dependencyVersion, String dependerName, String dependencyName) Compares the versions of a depender and a dependency to determine if they are equal. Updates the context's status manager with version information and logs a warning if the versions differ.- Since:
- 1.5.26
-
addFoundVersionStatus
-
nameToPropertiesFilename
-
compareExpectedAndFoundVersion
public void compareExpectedAndFoundVersion(String actualDependencyVersion, Class<?> dependerClass, String dependerVersion, String dependerName, String dependencyName) Compares the expected version of a dependency with the actual version found and updates the status context. If the versions do not match, a warning is added to the context's status manager.Note: This method is used be logback-access-jetty11/12 and logback-access-tomcat.
-