Returns the last available version of an artifact

@param gavc String
@return String
489889
public String getArtifactLastVersion(final String gavc) {
        final List<String> versions = getArtifactVersions(gavc);

        final VersionsHandler versionHandler = new VersionsHandler(repositoryHandler);
        final String viaCompare = versionHandler.getLastVersion(versions);

        if (viaCompare != null) {
            return viaCompare;
        }

        //
        // These versions cannot be compared
        // Let's use the Collection.max() method by default, so goingo for a fallback
        // mechanism.
        //
        LOG.info("The versions cannot be compared");
        return Collections.max(versions);

    }
1306189
public static String getVersion(Class<?> aClass, String groupId, String artifactId) {
        String version = null;
        // lets try find the maven property - as the Java API rarely works :)
        InputStream is = null;
        String fileName = "/META-INF/maven/" +
                groupId + "/" + artifactId +
                "/pom.properties";
        // try to load from maven properties first
        try {
            Properties p = new Properties();
            is = aClass.getResourceAsStream(fileName);
            if (is != null) {
                p.load(is);
                version = p.getProperty("version", "");
            }
        } catch (Exception e) {
            // ignore
        } finally {
            if (is != null) {
                IOHelper.close(is, fileName, LOG);
            }
        }
        if (version == null) {
            Package aPackage = aClass.getPackage();
            if (aPackage != null) {
                version = aPackage.getImplementationVersion();
                if (Strings.isBlank(version)) {
                    version = aPackage.getSpecificationVersion();
                }
            }
        }
        if (version == null) {
            Enumeration<URL> resources = null;
            try {
                resources = aClass.getClassLoader().getResources("META-INF/MANIFEST.MF");
            } catch (IOException e) {
                // ignore
            }
            if (resources != null) {
                String expectedBundleName = groupId + "." + artifactId;
                while (resources.hasMoreElements()) {
                    try {
                        Manifest manifest = new Manifest(resources.nextElement().openStream());
                        Attributes attributes = manifest.getMainAttributes();
                        String bundleName = attributes.getValue("Bundle-SymbolicName");
                        if (Objects.equals(expectedBundleName, bundleName)) {
                            version = attributes.getValue("Implementation-Version");
                            if (Strings.isNotBlank(version)) break;
                        }
                    } catch (IOException e) {
                        // ignore
                    }
                }
            }
        }
        return version;
    }
1309760
public function getAsseticVersionUrl($url)
    {
        $tmp = $this->getParameter('assetic_versions');

        if ($tmp && is_array($tmp)) {
            $tmpUrl = basename($url);
            $url .= '?'.(isset($tmp[$tmpUrl]) && $tmp[$tmpUrl] ? $tmp[$tmpUrl] : (isset($tmp['global']) ? $tmp['global'] : ''));
        }

        return $url;
    }
131217
@Override
    public String getEtagValue() {
        final Instant lastModifiedDate = getLastModifiedDate();

        if (lastModifiedDate != null) {
            return sha1Hex(getPath() + lastModifiedDate.toEpochMilli());
        }
        return "";
    }
249150
protected long getLastModified(IAggregator aggregator, ModuleList modules) {
		long result = 0L;
		for (ModuleList.ModuleListEntry entry : modules) {
			IResource resource = entry.getModule().getResource(aggregator);
			long lastMod = resource.lastModified();
			result = Math.max(result, lastMod);
		}
		return result;
	}
256781
public static String versionInfoString(Detail detail) {
        StringBuilder sb = new StringBuilder();
        for(VersionInfo grp : getVersionInfos()){
            sb.append(grp.getGroupId()).append(" : ").append(grp.getArtifactId()).append(" : ").append(grp.getBuildVersion());
            switch (detail){
                case FULL:
                case GAVC:
                    sb.append(" - ").append(grp.getCommitIdAbbrev());
                    if(detail != Detail.FULL) break;

                    sb.append("buildTime=").append(grp.getBuildTime()).append("branch=").append(grp.getBranch())
                            .append("commitMsg=").append(grp.getCommitMessageShort());
            }
            sb.append("\n");
        }
        return sb.toString();
    }
584476
public function getVersion()
    {
        if ($package = $this->getComposerInstall()) {
            if ($package->version === 'dev-master') {
                return 'dev-master (' . substr($package->source->reference, 0, 8) . ')';
            }
            return 'v' . $package->version;
        }
        return 'v' . self::$VERSION;
    }
946318
@GET
    @Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
    @Path("/{gavc}" + ServerAPI.GET_VERSIONS)
    public Response getVersions(@PathParam("gavc") final String gavc){
        if(LOG.isInfoEnabled()) {
            LOG.info(String.format("Got a get artifact versions request [%s]", gavc));
        }

        final ListView view = new ListView("Versions View", "version");

        final List<String> versions = getArtifactHandler().getArtifactVersions(gavc);
        Collections.sort(versions);
        view.addAll(versions);

        return Response.ok(view).build();
    }
620472
def get_sdk_version(self):
        """"""
        name = 'VCVarsQueryRegistry.bat'
        path = os.path.join(self.tool_dir, name)
        batch = read_file(path)
        if not batch:
            raise RuntimeError(_('failed to find the SDK version'))
        regex = r'(?<=\\Microsoft SDKs\\Windows\\).+?(?=")'
        try:
            version = re.search(regex, batch).group()
        except AttributeError:
            return ''
        else:
            logging.debug(_('SDK version: %s'), version)
            return version
1290845
public static int getJavaCompilerVersion() {
		int cv = compilerVersion.get();
		if (cv != -1) return cv;
		
		/* Main algorithm: Use JavaCompiler's intended method to do this */ {
			Matcher m = VERSION_PARSER.matcher(JavaCompiler.version());
			if (m.matches()) {
				int major = Integer.parseInt(m.group(1));
				if (major == 1) {
					int minor = Integer.parseInt(m.group(2));
					return setVersion(minor);
				}
				if (major >= 9) return setVersion(major);
			}
		}
		
		/* Fallback algorithm one: Check Source's values. Lets hope oracle never releases a javac that recognizes future versions for -source */ {
			String name = Source.values()[Source.values().length - 1].name();
			Matcher m = SOURCE_PARSER.matcher(name);
			if (m.matches()) {
				int major = Integer.parseInt(m.group(1));
				if (major == 1) {
					int minor = Integer.parseInt(m.group(2));
					return setVersion(minor);
				}
				if (major >= 9) return setVersion(major);
			}
		}
		return setVersion(6);
	}
1025599
protected function _readGarpVersion() {
        $versionInCaseOfError = 'v0.0.0';
        $lockFilePath = APPLICATION_PATH . '/../composer.lock';
        if (!file_exists($lockFilePath)) {
            return $versionInCaseOfError;
        }
        $lockFile = json_decode(file_get_contents($lockFilePath), true);
        $packages = $lockFile['packages'];

        return array_reduce(
            $packages,
            function ($prevVersion, $package) {
                // Found Garp? Return its version
                if ($package['name'] === 'grrr-amsterdam/garp3') {
                    return $package['version'];
                }
                // Otherwise return whatever version we previously got
                return $prevVersion;
            },
            // Initial value
            $versionInCaseOfError
        );
    }
30594
private void checkGwtUserVersion() throws MojoExecutionException
    {
        InputStream inputStream = Thread.currentThread().getContextClassLoader()
            .getResourceAsStream( "org/codehaus/mojo/gwt/mojoGwtVersion.properties" );
        Properties properties = new Properties();
        try
        {
            properties.load( inputStream );

        }
        catch (IOException e)
        {
            throw new MojoExecutionException( "Failed to load plugin properties", e );
        }
        finally
        {
            IOUtils.closeQuietly( inputStream );
        }

        Artifact gwtUser = project.getArtifactMap().get( GWT_USER );
        if (gwtUser != null)
        {
            String mojoGwtVersion = properties.getProperty( "gwt.version" );
            //ComparableVersion with an up2date maven version
            ArtifactVersion mojoGwtArtifactVersion = new DefaultArtifactVersion( mojoGwtVersion );
            ArtifactVersion userGwtArtifactVersion = new DefaultArtifactVersion( gwtUser.getVersion() );
            if ( userGwtArtifactVersion.compareTo( mojoGwtArtifactVersion ) < 0 )
            {
                getLog().warn( "Your project declares dependency on gwt-user " + gwtUser.getVersion()
                                   + ". This plugin is designed for at least gwt version " + mojoGwtVersion );
            }
        }
    }
420531
def get_version(self, cached=True):
        """"""
        if hasattr(self.__class__, '_version') and cached:
            version = self.__class__._version
        else:
            repo = self.get_repo()
            if repo is not None:
                head = repo.head
                version = head.commit.hexsha
                if repo.is_dirty():
                    version += "*"
            else:
                version = None
        self.__class__._version = version
        return version
275191
@GwtIncompatible("java.util.ResourceBundle")
  public static String getReleaseVersion() {
    ResourceBundle config = ResourceBundle.getBundle(CONFIG_RESOURCE);
    return config.getString("compiler.version");
  }
1311159
@Override
	public long lastModified() {
		// return the latest of each of the resources in this aggregated
		// resource
		long result = -1;
		for (IResource resource : resources) {
			result = Math.max(result, resource.lastModified());
		}
		return result;
	}
889714
public String getVersion(String configString) {
    if (configString == null
        || configString.trim().isEmpty()
        || configString.equals(APPENGINE_CONFIG)) {
      throw new GradleException(VERSION_ERROR);
    }
    if (configString.equals(GCLOUD_CONFIG)) {
      // can be null to allow gcloud to generate this
      return null;
    }
    return configString;
  }
1257545
private static function fetchProtocolVersion(string $version): string
    {
        $v = substr($version, 5);

        if ($v === '2.0') {
            return '2';
        }

        // Fallback for values outside of valid protocol versions
        if (!in_array($v, static::$allowedVersions, true)) {
            return '1.1';
        }

        return $v;
    }