Java Code Examples for org.jboss.forge.addon.dependencies.Coordinate#getVersion()

The following examples show how to use org.jboss.forge.addon.dependencies.Coordinate#getVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RulesetsUpdater.java    From windup with Eclipse Public License 1.0 6 votes vote down vote up
public String replaceRulesetsDirectoryWithLatestReleaseIfAny() throws IOException, DependencyException
{
    if (!this.rulesetsNeedUpdate(false))
        return null;

    Path windupRulesDir = getRulesetsDir();
    Path coreRulesetsDir = windupRulesDir.resolve(RULESET_CORE_DIRECTORY);

    Coordinate rulesetsCoord = getLatestReleaseOf(RULES_GROUP_ID, RULESETS_ARTIFACT_ID);
    if(rulesetsCoord == null)
        throw new WindupException("No Windup rulesets release found.");

    FileUtils.deleteDirectory(coreRulesetsDir.toFile());
    extractArtifact(rulesetsCoord, coreRulesetsDir.toFile());

    return rulesetsCoord.getVersion();
}
 
Example 2
Source File: RulesetsUpdater.java    From windup with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @return Finds the latest non-SNAPSHOT of given artifact.
 */
public Coordinate getLatestReleaseOf(final CoordinateBuilder coord)
{
    List<Coordinate> availableVersions = depsResolver.resolveVersions(DependencyQueryBuilder.create(coord));

    // Find the latest non-SNAPSHOT and non-CR version.
    for(int i = availableVersions.size()-1; i >= 0; i--)
    {
        Coordinate availableCoord = availableVersions.get(i);
        String versionStr = availableCoord.getVersion();

        if(versionStr != null && !availableCoord.isSnapshot() && !versionStr.matches(".*CR[0-9]$"))
            return availableCoord;
    }
    return null;
}
 
Example 3
Source File: RulesetsUpdater.java    From windup with Eclipse Public License 1.0 5 votes vote down vote up
private SingleVersion getLatestCoreRulesetVersion()
{
    Coordinate lastRelease = this.getLatestReleaseOf(RULES_GROUP_ID, RULESETS_ARTIFACT_ID);
    if (lastRelease == null)
        return null;
    return new SingleVersion(lastRelease.getVersion());
}