VersionScheme versionScheme = new GenericVersionScheme();
private Version parseVersion(String versionString) { try { return new GenericVersionScheme().parseVersion(versionString); } catch (InvalidVersionSpecificationException ex) { throw new IllegalArgumentException(ex); } }
GenericVersionScheme versionScheme = new GenericVersionScheme(); rootNode.setVersion(versionScheme.parseVersion(pomVersion)); rootNode.setVersionConstraint(versionScheme.parseVersionConstraint(pomVersion)); DependencyNode pomNode = rootNode;
VersionConstraint vc = new GenericVersionScheme().parseVersionConstraint(artifact.getVersion()); if (vc.getVersion() != null && !vc.getVersion().toString().endsWith("SNAPSHOT")) { for (LocalRepository repo : defaultRepos) {
VersionRange range = parseVersionRange( process.substring( 0, index + 1 ) ); ranges.add( range ); if ( ranges.isEmpty() ) result = new GenericVersionConstraint( parseVersion( constraint ) );
public boolean accepts( final IndexingContext ctx, final ArtifactInfo ai ) { try { final Version aiV = versionScheme.parseVersion( ai.getVersion() ); // Use ">=" if you are INCLUSIVE return aiV.compareTo( version ) > 0; } catch ( InvalidVersionSpecificationException e ) { // do something here? be safe and include? return true; } } };
private static Version getBundleVersion(String version) { try { return new GenericVersionScheme().parseVersion(version); } catch (InvalidVersionSpecificationException e) { throw new InvalidDependencyVersionException("Unable to parse bundle version: " + version); } } }
VersionRange range = parseVersionRange( process.substring( 0, index + 1 ) ); ranges.add( range ); if ( ranges.isEmpty() ) result = new GenericVersionConstraint( parseVersion( constraint ) );
return AETHERVERSIONSCHEME.parseVersion(versionConstraint.getVersion().getValue()); } catch (InvalidVersionSpecificationException e) { throw new ResolveException("Invalid version [" + versionConstraint.getVersion() + "]", e); if (strictVersion != null) { try { return AETHERVERSIONSCHEME.parseVersion(strictVersion.getValue()); } catch (InvalidVersionSpecificationException e) { throw new ResolveException("Invalid version [" + versionConstraint.getVersion() + "]", e);
public boolean isMavenVersion( String versionRange ) { VersionScheme versionScheme = new GenericVersionScheme(); Validate.notBlank( versionRange, "versionRange can neither be null, empty nor blank" ); VersionConstraint constraint; try { constraint = versionScheme.parseVersionConstraint( versionRange ); } catch ( InvalidVersionSpecificationException e ) { throw new IllegalArgumentException( e.getMessage(), e ); } Version current; try { String mavenVersion = getMavenVersion(); Validate.validState( StringUtils.isNotEmpty( mavenVersion ), "Could not determine current Maven version" ); current = versionScheme.parseVersion( mavenVersion ); } catch ( InvalidVersionSpecificationException e ) { throw new IllegalStateException( "Could not parse current Maven version: " + e.getMessage(), e ); } if ( constraint.getRange() == null ) { return constraint.getVersion().compareTo( current ) <= 0; } return constraint.containsVersion( current ); }
private Version getLatestFromFile(Path containerDir) throws IOException { Path latestFile = containerDir.resolve(LATEST_FILE); if (Files.notExists(latestFile)) { return null; } String versionString = new String(Files.readAllBytes(latestFile)); try { if (StringUtils.isNotBlank(versionString)) { return new GenericVersionScheme().parseVersion(versionString); } } catch (InvalidVersionSpecificationException e) { //ignore } return null; }
VersionScheme versionScheme = new GenericVersionScheme();
BomVersion resolve(String requested) { String property = requested; String value = requested; while (value != null && value.startsWith("${") && value.endsWith("}")) { property = value.substring(2, value.length() - 1); value = this.versions.get(property); } if (value == null) { return null; } try { return new BomVersion(property, new GenericVersionScheme().parseVersion(value)); } catch (InvalidVersionSpecificationException ex) { throw new RuntimeException(ex); } }
VersionScheme versionScheme = new GenericVersionScheme(); try { versionScheme.parseVersion(artifact.getVersion());
AetherVersion( String version ) throws VersionParseException { try { this.version = new GenericVersionScheme().parseVersion( version ); } catch ( InvalidVersionSpecificationException e ) { throw new VersionParseException( e.getMessage() ); } }
public JenkinsPluginsProvisioner(MavenProvisioner provisioner, ArtifactDescriptorReader descriptorReader) { this.provisioner = provisioner; this.descriptorReader = descriptorReader; this.versions = new GenericVersionScheme(); }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (attrs.isRegularFile()) { String filename = file.getFileName().toString(); if (filename.startsWith(CONTAINER_JAR_PREFIX) && filename.endsWith(CONTAINER_JAR_SUFFIX)) { String jarVersionString = StringUtils.substringBetween(filename, CONTAINER_JAR_PREFIX, CONTAINER_JAR_SUFFIX); try { Version jarVersion = new GenericVersionScheme().parseVersion(jarVersionString); if (null == latestVersion || jarVersion.compareTo(latestVersion) > 0) { latestVersion = jarVersion; latestJar = file; } } catch (InvalidVersionSpecificationException e) { //ignore } } } return FileVisitResult.CONTINUE; }
VersionScheme versionScheme = new GenericVersionScheme(); try { versionScheme.parseVersion(artifact.getVersion());
GenericVersionScheme genericVersionScheme = new GenericVersionScheme(); Version currentArtifactVersion = genericVersionScheme.parseVersion(currentArtifact.getVersion()); Version artifactVersion = genericVersionScheme.parseVersion(artifact.getVersion()); if (currentArtifactVersion.compareTo(artifactVersion) >= 0){
public ArtifactInfo() { versionScheme = new GenericVersionScheme(); }