Package org.scijava.util
Class VersionUtils
- java.lang.Object
-
- org.scijava.util.VersionUtils
-
-
Constructor Summary
Constructors Constructor Description VersionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intcompare(String v1, String v2)Compares two version strings.static StringgetBuildNumber(Class<?> c)Looks up the build number (typically an SCM revision) of the specified class.static StringgetVersion(Class<?> c)Looks up the version of the specified class using any means available, appending the build number to anySNAPSHOTversion.static StringgetVersion(Class<?> c, String groupId, String artifactId)Looks up the version of the specified class using any means available, appending the build number to anySNAPSHOTversion.static StringgetVersionFromManifest(Class<?> c)Looks up the version of the specified class using a JAR manifest if available, appending the build number to anySNAPSHOTversion.static StringgetVersionFromPOM(Class<?> c, String groupId, String artifactId)Looks up the version of the specified class using the specified POM, or base POM directory ifgroupIdandartifactIdarenull.
-
-
-
Method Detail
-
getVersion
public static String getVersion(Class<?> c)
Looks up the version of the specified class using any means available, appending the build number to anySNAPSHOTversion. Will only search POMs in the base directory.- Parameters:
c- - Look up this class's version- Returns:
- Version of specified
Classor null if not found.
-
getVersion
public static String getVersion(Class<?> c, String groupId, String artifactId)
Looks up the version of the specified class using any means available, appending the build number to anySNAPSHOTversion. ThegroupIdandartifactIdparameters allow specification of the POM lookup path.- Parameters:
c- - Look up this class's versiongroupId- - Maven group ID containing classartifactId- - Maven artifact ID containing class- Returns:
- Version of specified
Classor null if not found.
-
getVersionFromManifest
public static String getVersionFromManifest(Class<?> c)
Looks up the version of the specified class using a JAR manifest if available, appending the build number to anySNAPSHOTversion.- Parameters:
c- - Look up this class's version- Returns:
- Version of specified
Classor null if not found.
-
getVersionFromPOM
public static String getVersionFromPOM(Class<?> c, String groupId, String artifactId)
Looks up the version of the specified class using the specified POM, or base POM directory ifgroupIdandartifactIdarenull.- Parameters:
c- - Look up this class's versiongroupId- - Maven group ID containing classartifactId- - Maven artifact ID containing class- Returns:
- Version of specified
Classor null if not found.
-
getBuildNumber
public static String getBuildNumber(Class<?> c)
Looks up the build number (typically an SCM revision) of the specified class. This information is retrieved from the JAR manifest'sImplementation-Buildentry, or null if no such value exists.- Parameters:
c- - Look up this class's build number- Returns:
- Build number of specified
Classor null if not found.
-
-