Refine search
String pomPropertiesArtifactId = props.getProperty("artifactId"); String pomPropertiesGroupId = props.getProperty("groupId"); return parseVersion(versionStr, pomPropertiesGroupId, pomPropertiesArtifactId); } catch (IOException e) { _close(pomProperties); return Version.unknownVersion();
@Override protected char _decodeEscaped() throws IOException { VersionUtil.throwInternal(); return ' '; }
/** * Method used by <code>PackageVersion</code> classes to decode version injected by Maven build. */ public static Version parseVersion(String s, String groupId, String artifactId) { if (s != null && (s = s.trim()).length() > 0) { String[] parts = V_SEP.split(s); return new Version(parseVersionPart(parts[0]), (parts.length > 1) ? parseVersionPart(parts[1]) : 0, (parts.length > 2) ? parseVersionPart(parts[2]) : 0, (parts.length > 3) ? parts[3] : null, groupId, artifactId); } return Version.unknownVersion(); }
private void updateTopology(String oldVersion) { Version v = Version.unknownVersion(); if (oldVersion != null) { v = VersionUtil.parseVersion(oldVersion, null, null); } if (v.isUnknownVersion() || v.compareTo(new Version(1, 5, 0, null, null, null)) < 0) { if (this.sqlDialect.supportsDeferrableForeignKey()) { upgradeForeignKeysToDeferrable(); } } if (v.isUnknownVersion() || v.compareTo(new Version(2, 0, 0, null, null, null)) < 0) { addPartitionSupportToSqlgSchema(); } }
public static Version parseVersion(String s, String groupId, String artifactId) { if (s != null && (s = s.trim()).length() > 0) { String[] parts = V_SEP.split(s); return new Version(parseVersionPart(parts[0]), (parts.length > 1) ? parseVersionPart(parts[1]) : 0, (parts.length > 2) ? parseVersionPart(parts[2]) : 0, (parts.length > 3) ? parts[3] : null, groupId, artifactId); } return null; }
/** * Deprecated method copied from Jackson VersionUtil as this is exactly what we want :) * * @param groupId The maven groupId of this module. * @param artifactId The maven artifactId of this module. * @return The version of this maven artifact. */ private static Version mavenVersionFor(/*ClassLoader cl,*/ String groupId, String artifactId) { String groupPath = groupId.replaceAll(Pattern.quote("."), "/"); String resource = "/META-INF/maven/" + groupPath + '/' + artifactId + "/pom.properties"; InputStream pomProperties = null; try { Properties props = new Properties(); props.load(pomProperties = Compatibility.class.getResourceAsStream(resource)); String versionStr = props.getProperty("version"); String pomPropertiesArtifactId = props.getProperty("artifactId"); String pomPropertiesGroupId = props.getProperty("groupId"); return VersionUtil.parseVersion(versionStr, pomPropertiesGroupId, pomPropertiesArtifactId); } catch (Exception e) { LOGGER.log(Level.FINEST, "Exception ignored while loading maven version.", e); } finally { _close(pomProperties); } return Version.unknownVersion(); }
protected VersionUtil() { Version v = null; try { /* Class we pass only matters for resource-loading: can't use this Class * (as it's just being loaded at this point), nor anything that depends on it. */ v = VersionUtil.versionFor(getClass()); } catch (Exception e) { // not good to dump to stderr; but that's all we have at this low level System.err.println("ERROR: Failed to load Version information from "+getClass()); } if (v == null) { v = Version.unknownVersion(); } _v = v; }
/** * Helper method that will try to load version information for specified * class. Implementation is as follows: * * First, tries to load version info from a class named * "PackageVersion" in the same package as the class. * * If no version information is found, {@link Version#unknownVersion()} is returned. */ public static Version versionFor(Class<?> cls) { Version version = packageVersionFor(cls); return version == null ? Version.unknownVersion() : version; }
public static Version versionFor(Class<?> cls) Version packageVersion = packageVersionFor(cls); if (packageVersion != null) { return packageVersion; return Version.unknownVersion(); return doReadVersion(reader); } catch (UnsupportedEncodingException e) { return Version.unknownVersion(); } finally { _close(in);
/** * Creates a new {@link PackageVersion}. */ public PackageVersion() { super(); this.version = VersionUtil.parseVersion("${project.version}", "${project.groupId}", "${project.artifactId}"); assert this.version != null; }
@Override public Version version() { return VersionUtil.versionFor(getClass()); }
private static Version doReadVersion(final Reader r) { String version = null, group = null, artifact = null; final BufferedReader br = new BufferedReader(r); try { version = br.readLine(); if (version != null) { group = br.readLine(); if (group != null) { artifact = br.readLine(); } } } catch (IOException ignored) { } finally { _close(br); } // We don't trim() version: parseVersion() takes care ot that if (group != null) { group = group.trim(); } if (artifact != null) { artifact = artifact.trim(); } return parseVersion(version, group, artifact); }
@Override @SuppressWarnings("deprecation") public Version version() { return VersionUtil.mavenVersionFor(ConstraintViolationProblemModule.class.getClassLoader(), "org.zalando", "problem-violations"); }
private void updateTopology(String oldVersion) { Version v = Version.unknownVersion(); if (oldVersion != null) { v = VersionUtil.parseVersion(oldVersion, null, null); } if (v.isUnknownVersion() || v.compareTo(new Version(1, 5, 0, null, null, null)) < 0) { if (this.sqlDialect.supportsDeferrableForeignKey()) { upgradeForeignKeysToDeferrable(); } } if (v.isUnknownVersion() || v.compareTo(new Version(2, 0, 0, null, null, null)) < 0) { addPartitionSupportToSqlgSchema(); } }
public static Version parseVersion(String s, String groupId, String artifactId) { if (s != null && (s = s.trim()).length() > 0) { String[] parts = V_SEP.split(s); return new Version(parseVersionPart(parts[0]), (parts.length > 1) ? parseVersionPart(parts[1]) : 0, (parts.length > 2) ? parseVersionPart(parts[2]) : 0, (parts.length > 3) ? parts[3] : null, groupId, artifactId); } return null; }
String pomPropertiesArtifactId = props.getProperty("artifactId"); String pomPropertiesGroupId = props.getProperty("groupId"); return parseVersion(versionStr, pomPropertiesGroupId, pomPropertiesArtifactId); } catch (IOException e) { return Version.unknownVersion();
protected VersionUtil() { Version v = null; try { /* Class we pass only matters for resource-loading: can't use this Class * (as it's just being loaded at this point), nor anything that depends on it. */ v = VersionUtil.versionFor(getClass()); } catch (Exception e) { // not good to dump to stderr; but that's all we have at this low level System.err.println("ERROR: Failed to load Version information from "+getClass()); } if (v == null) { v = Version.unknownVersion(); } _v = v; }
/** * Helper method that will try to load version information for specified * class. Implementation is as follows: * * First, tries to load version info from a class named * "PackageVersion" in the same package as the class. * * If no version information is found, {@link Version#unknownVersion()} is returned. */ public static Version versionFor(Class<?> cls) { Version version = packageVersionFor(cls); return version == null ? Version.unknownVersion() : version; }
public static Version versionFor(Class<?> cls) Version packageVersion = packageVersionFor(cls); if (packageVersion != null) { return packageVersion; return Version.unknownVersion(); return doReadVersion(reader); } catch (UnsupportedEncodingException e) { return Version.unknownVersion(); } finally { _close(in);
@Override public Version version() { return VersionUtil.parseVersion("0.0.1", "foo", "bar"); }