/** * Looks up the version of the specified class using any means available, * appending the build number to any {@code SNAPSHOT} version. The * {@code groupId} and {@code artifactId} parameters allow specification of * the POM lookup path. * * @param c - Look up this class's version * @param groupId - Maven group ID containing class * @param artifactId - Maven artifact ID containing class * @return Version of specified {@link Class} or null if not found. */ public static String getVersion(final Class<?> c, final String groupId, final String artifactId) { final String version = getVersionFromManifest(c); if (version != null) return version; return getVersionFromPOM(c, groupId, artifactId); }
/** * Looks up the version of the specified class using any means available, * appending the build number to any {@code SNAPSHOT} version. The * {@code groupId} and {@code artifactId} parameters allow specification of * the POM lookup path. * * @param c - Look up this class's version * @param groupId - Maven group ID containing class * @param artifactId - Maven artifact ID containing class * @return Version of specified {@link Class} or null if not found. */ public static String getVersion(final Class<?> c, final String groupId, final String artifactId) { final String version = getVersionFromManifest(c); if (version != null) return version; return getVersionFromPOM(c, groupId, artifactId); }