当前位置: 首页>>代码示例>>Java>>正文


Java ArtifactUtils.isSnapshot方法代码示例

本文整理汇总了Java中org.apache.maven.artifact.ArtifactUtils.isSnapshot方法的典型用法代码示例。如果您正苦于以下问题:Java ArtifactUtils.isSnapshot方法的具体用法?Java ArtifactUtils.isSnapshot怎么用?Java ArtifactUtils.isSnapshot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.artifact.ArtifactUtils的用法示例。


在下文中一共展示了ArtifactUtils.isSnapshot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getVersions

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
/**
 * Uses the {@link DefaultVersionsHelper} to find all available versions that match all the associations with this
 * property.
 *
 * @param includeSnapshots Whether to include snapshot versions in our search.
 * @return The (possibly empty) array of versions.
 */
public synchronized ArtifactVersion[] getVersions( boolean includeSnapshots )
{
    Set<ArtifactVersion> result;
    if ( includeSnapshots )
    {
        result = versions;
    }
    else
    {
        result = new TreeSet<>( getVersionComparator() );
        for ( ArtifactVersion candidate : versions )
        {
            if ( ArtifactUtils.isSnapshot( candidate.toString() ) )
            {
                continue;
            }
            result.add( candidate );
        }
    }
    return asArtifactVersionArray( result );
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:29,代码来源:PropertyVersions.java

示例2: getVersions

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public ArtifactVersion[] getVersions( boolean includeSnapshots )
{
    Set<ArtifactVersion> result;
    if ( includeSnapshots )
    {
        result = versions;
    }
    else
    {
        result = new TreeSet<>( versionComparator );
        for ( ArtifactVersion candidate : versions )
        {
            if ( ArtifactUtils.isSnapshot( candidate.toString() ) )
            {
                continue;
            }
            result.add( candidate );
        }
    }
    return result.toArray( new ArtifactVersion[result.size()] );
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:22,代码来源:ArtifactVersions.java

示例3: getNewVersion

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private String getNewVersion( ExternalVersionStrategy strategy, MavenProject mavenProject )
    throws ExternalVersionException
{

    // snapshot detection against the old version.
    boolean isSnapshot = ArtifactUtils.isSnapshot( mavenProject.getVersion() );

    // lookup the new version
    String newVersion = strategy.getVersion( mavenProject );

    if ( newVersion != null )
    {
        newVersion = newVersion.trim();
    }

    boolean isNewSnapshot = ArtifactUtils.isSnapshot( newVersion );
    // make sure we still have a SNAPSHOT if we had one previously.
    if ( isSnapshot && !isNewSnapshot )
    {
        newVersion = newVersion + "-SNAPSHOT";
    }
    return newVersion;
}
 
开发者ID:bdemers,项目名称:maven-external-version,代码行数:24,代码来源:ExternalVersionExtension.java

示例4: getVersions

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
/**
 * Uses the {@link DefaultVersionsHelper} to find all available versions that match all
 * the associations with this property.
 *
 * @param includeSnapshots Whether to include snapshot versions in our search.
 * @return The (possibly empty) array of versions.
 */
public synchronized ArtifactVersion[] getVersions( boolean includeSnapshots )
{
    Set<ArtifactVersion> result;
    if ( includeSnapshots )
    {
        result = versions;
    }
    else
    {
        result = new TreeSet<ArtifactVersion>( getVersionComparator() );
        for ( ArtifactVersion candidate : versions )
        {
            if ( ArtifactUtils.isSnapshot( candidate.toString() ) )
            {
                continue;
            }
            result.add( candidate );
        }
    }
    return asArtifactVersionArray( result );
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:29,代码来源:PropertyVersions.java

示例5: getVersions

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public ArtifactVersion[] getVersions( boolean includeSnapshots )
{
    Set<ArtifactVersion> result;
    if ( includeSnapshots )
    {
        result = versions;
    }
    else
    {
        result = new TreeSet<ArtifactVersion>( versionComparator );
        for ( ArtifactVersion candidate : versions )
        {
            if ( ArtifactUtils.isSnapshot( candidate.toString() ) )
            {
                continue;
            }
            result.add( candidate );
        }
    }
    return result.toArray( new ArtifactVersion[result.size()] );
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:22,代码来源:ArtifactVersions.java

示例6: getHtmlDisplayName

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
@Override
public String getHtmlDisplayName() {
    StringBuilder n = new StringBuilder("<html>");
    n.append(getDisplayName());
    if (ArtifactUtils.isSnapshot(data.art.getVersion()) && data.art.getVersion().indexOf("SNAPSHOT") < 0) { //NOI18N
        n.append(" <b>[").append(data.art.getVersion()).append("]</b>");
    }
    if (!data.art.getArtifactHandler().isAddedToClasspath() && !Artifact.SCOPE_COMPILE.equals(data.art.getScope())) {
        n.append("  <i>[").append(data.art.getScope()).append("]</i>");
    }
    n.append("</html>");
    return n.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DependencyNode.java

示例7: getNewestVersion

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public final ArtifactVersion getNewestVersion( VersionRange versionRange, ArtifactVersion lowerBound,
                                               ArtifactVersion upperBound, boolean includeSnapshots,
                                               boolean includeLower, boolean includeUpper )
{
    ArtifactVersion latest = null;
    final VersionComparator versionComparator = getVersionComparator();
    Iterator i = Arrays.asList( getVersions( includeSnapshots ) ).iterator();
    while ( i.hasNext() )
    {
        ArtifactVersion candidate = (ArtifactVersion) i.next();
        if ( versionRange != null && !ArtifactVersions.isVersionInRange( candidate, versionRange ) )
        {
            continue;
        }
        int lower = lowerBound == null ? -1 : versionComparator.compare( lowerBound, candidate );
        int upper = upperBound == null ? +1 : versionComparator.compare( upperBound, candidate );
        if ( lower > 0 || upper < 0 )
        {
            continue;
        }
        if ( ( !includeLower && lower == 0 ) || ( !includeUpper && upper == 0 ) )
        {
            continue;
        }
        if ( !includeSnapshots && ArtifactUtils.isSnapshot( candidate.toString() ) )
        {
            continue;
        }
        if ( latest == null )
        {
            latest = candidate;
        }
        else if ( versionComparator.compare( latest, candidate ) < 0 )
        {
            latest = candidate;
        }

    }
    return latest;
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:41,代码来源:AbstractVersionDetails.java

示例8: getOldestVersion

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public final ArtifactVersion getOldestVersion( VersionRange versionRange, ArtifactVersion lowerBound,
                                               ArtifactVersion upperBound, boolean includeSnapshots,
                                               boolean includeLower, boolean includeUpper )
{
    ArtifactVersion oldest = null;
    final VersionComparator versionComparator = getVersionComparator();
    Iterator i = Arrays.asList( getVersions( includeSnapshots ) ).iterator();
    while ( i.hasNext() )
    {
        ArtifactVersion candidate = (ArtifactVersion) i.next();
        if ( versionRange != null && !ArtifactVersions.isVersionInRange( candidate, versionRange ) )
        {
            continue;
        }
        int lower = lowerBound == null ? -1 : versionComparator.compare( lowerBound, candidate );
        int upper = upperBound == null ? +1 : versionComparator.compare( upperBound, candidate );
        if ( lower > 0 || upper < 0 )
        {
            continue;
        }
        if ( ( !includeLower && lower == 0 ) || ( !includeUpper && upper == 0 ) )
        {
            continue;
        }
        if ( !includeSnapshots && ArtifactUtils.isSnapshot( candidate.toString() ) )
        {
            continue;
        }
        if ( oldest == null )
        {
            oldest = candidate;
        }
        else if ( versionComparator.compare( oldest, candidate ) > 0 )
        {
            oldest = candidate;
        }
    }
    return oldest;
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:40,代码来源:AbstractVersionDetails.java

示例9: getVersions

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public final ArtifactVersion[] getVersions( VersionRange versionRange, ArtifactVersion lowerBound,
                                            ArtifactVersion upperBound, boolean includeSnapshots,
                                            boolean includeLower, boolean includeUpper )
{
    final VersionComparator versionComparator = getVersionComparator();
    Set<ArtifactVersion> result = new TreeSet<>( versionComparator );
    for ( ArtifactVersion candidate : Arrays.asList( getVersions( includeSnapshots ) ) )
    {
        if ( versionRange != null && !ArtifactVersions.isVersionInRange( candidate, versionRange ) )
        {
            continue;
        }
        int lower = lowerBound == null ? -1 : versionComparator.compare( lowerBound, candidate );
        int upper = upperBound == null ? +1 : versionComparator.compare( upperBound, candidate );
        if ( lower > 0 || upper < 0 )
        {
            continue;
        }
        if ( ( !includeLower && lower == 0 ) || ( !includeUpper && upper == 0 ) )
        {
            continue;
        }
        if ( !includeSnapshots && ArtifactUtils.isSnapshot( candidate.toString() ) )
        {
            continue;
        }
        result.add( candidate );
    }
    return result.toArray( new ArtifactVersion[result.size()] );
}
 
开发者ID:mojohaus,项目名称:versions-maven-plugin,代码行数:31,代码来源:AbstractVersionDetails.java

示例10: execute

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
@Override
protected void execute(final GitBranchType type, final String gitBranch, final String branchPattern) throws MojoExecutionException, MojoFailureException {
    if (GitBranchType.VERSIONED_TYPES.contains(type)) {
        getLog().debug("Versioned Branch Type: " + type + " with branchPattern: " + branchPattern + " Checking against current branch: " + gitBranch);
        Matcher gitMatcher = Pattern.compile(branchPattern).matcher(gitBranch);

        // We're in a release branch, we expect a non-SNAPSHOT version in the POM.
        if (gitMatcher.matches()) {
            if (ArtifactUtils.isSnapshot(project.getVersion())) {
                throw new MojoFailureException("The current git branch: [" + gitBranch + "] is defined as a release branch. The maven project version: [" + project.getVersion() + "] is currently a snapshot version.");
            }

            // Non-master version branches require a pom version match of some kind to the branch subgroups.
            if (gitMatcher.groupCount() > 0) {
                // HOTFIX and RELEASE branches require an exact match to the last subgroup.
                if ((GitBranchType.RELEASE.equals(type) || GitBranchType.HOTFIX.equals(type)) && !gitMatcher.group(gitMatcher.groupCount()).trim().equals(project.getVersion().trim())) {
                    throw new MojoFailureException("The current git branch: [" + gitBranch + "] expected the maven project version to be: [" + gitMatcher.group(gitMatcher.groupCount()).trim() + "], but the maven project version is: [" + project.getVersion() + "]");
                }

                // SUPPORT branches require a 'starts with' match of the maven project version to the subgroup.
                // ex: /origin/support/3.1 must have a maven version that starts with "3.1", ala: "3.1.2"
                if (GitBranchType.SUPPORT.equals(type) && !project.getVersion().startsWith(gitMatcher.group(gitMatcher.groupCount()).trim())) {
                    throw new MojoFailureException("The current git branch: [" + gitBranch + "] expected the maven project version to start with: [" + gitMatcher.group(gitMatcher.groupCount()).trim() + "], but the maven project version is: [" + project.getVersion() + "]");
                }
            }
        }
    } else if (GitBranchType.DEVELOPMENT.equals(type) && !ArtifactUtils.isSnapshot(project.getVersion())) {
        throw new MojoFailureException("The current git branch: [" + gitBranch + "] is detected as the gitflow development branch, and expects a maven project version ending with -SNAPSHOT. The maven project version found was: [" + project.getVersion() + "]");
    }
}
 
开发者ID:egineering-llc,项目名称:gitflow-helper-maven-plugin,代码行数:31,代码来源:EnforceVersionsMojo.java

示例11: getNewestVersion

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public final ArtifactVersion getNewestVersion( VersionRange versionRange, ArtifactVersion lowerBound,
                                               ArtifactVersion upperBound, boolean includeSnapshots,
                                               boolean includeLower, boolean includeUpper )
{
    ArtifactVersion latest = null;
    final VersionComparator versionComparator = getVersionComparator();
    Iterator i = Arrays.asList( getVersions( includeSnapshots ) ).iterator();
    while ( i.hasNext() )
    {
        ArtifactVersion candidate = (ArtifactVersion) i.next();
        if ( versionRange != null && !ArtifactVersions.isVersionInRange( candidate, versionRange ) )
        {
            continue;
        }
        int lower = lowerBound == null ? -1 : versionComparator.compare( lowerBound, candidate );
        int upper = upperBound == null ? +1 : versionComparator.compare( upperBound, candidate );
        if ( lower > 0 || upper < 0 )
        {
            continue;
        }
        if ( ( !includeLower && lower == 0 ) || ( !includeUpper && upper == 0 ) )
        {
            continue;
        }
        if ( !includeSnapshots && ArtifactUtils.isSnapshot( candidate.toString() ) )
        {
            continue;
        }
        if ( latest == null )
        {
            latest = candidate;
        }
        else if ( versionComparator.compare( latest, candidate ) < 0 )
        {
            latest = candidate;
        }
    }
    return latest;
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:40,代码来源:AbstractVersionDetails.java

示例12: getVersions

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
public final ArtifactVersion[] getVersions( VersionRange versionRange, ArtifactVersion lowerBound,
                                            ArtifactVersion upperBound, boolean includeSnapshots,
                                            boolean includeLower, boolean includeUpper )
{
    Set<ArtifactVersion> result;
    final VersionComparator versionComparator = getVersionComparator();
    result = new TreeSet<ArtifactVersion>( versionComparator );
    for ( ArtifactVersion candidate : Arrays.asList( getVersions( includeSnapshots ) ) )
    {
        if ( versionRange != null && !ArtifactVersions.isVersionInRange( candidate, versionRange ) )
        {
            continue;
        }
        int lower = lowerBound == null ? -1 : versionComparator.compare( lowerBound, candidate );
        int upper = upperBound == null ? +1 : versionComparator.compare( upperBound, candidate );
        if ( lower > 0 || upper < 0 )
        {
            continue;
        }
        if ( ( !includeLower && lower == 0 ) || ( !includeUpper && upper == 0 ) )
        {
            continue;
        }
        if ( !includeSnapshots && ArtifactUtils.isSnapshot( candidate.toString() ) )
        {
            continue;
        }
        result.add( candidate );
    }
    return result.toArray( new ArtifactVersion[result.size()] );
}
 
开发者ID:petr-ujezdsky,项目名称:versions-maven-plugin-svn-clone,代码行数:32,代码来源:AbstractVersionDetails.java

示例13: getArtifactVersion

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
private ArtifactVersion getArtifactVersion() {
    if (ArtifactUtils.isSnapshot(product_version)) {
        product_version = StringUtils.substring(product_version, 0, product_version.length()
                - Artifact.SNAPSHOT_VERSION.length() - 1);
    }
    return new DefaultArtifactVersion(product_version);
}
 
开发者ID:Labs64,项目名称:swid-maven-plugin,代码行数:8,代码来源:GenerateMojo.java

示例14: checkSnapshotDependencies

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
protected void checkSnapshotDependencies() throws MojoFailureException {
    getLog().info("Checking for SNAPSHOT versions in dependencies.");

    List<String> snapshots = new ArrayList<String>();
    List<String> builtArtifacts = new ArrayList<String>();

    List<MavenProject> projects = mavenSession.getProjects();
    for (MavenProject project : projects) {
        builtArtifacts.add(project.getGroupId() + ":"
                + project.getArtifactId() + ":" + project.getVersion());

        List<Dependency> dependencies = project.getDependencies();
        for (Dependency d : dependencies) {
            String id = d.getGroupId() + ":" + d.getArtifactId() + ":"
                    + d.getVersion();
            if (!builtArtifacts.contains(id)
                    && ArtifactUtils.isSnapshot(d.getVersion())) {
                snapshots.add(project + " -> " + d);
            }
        }
    }

    if (!snapshots.isEmpty()) {
        for (String s : snapshots) {
            getLog().warn(s);
        }
        throw new MojoFailureException(
                "There is some SNAPSHOT dependencies in the project, see warnings above. Change them or ignore with `allowSnapshots` property.");
    }
}
 
开发者ID:aleksandr-m,项目名称:gitflow-maven-plugin,代码行数:31,代码来源:AbstractGitFlowMojo.java

示例15: execute

import org.apache.maven.artifact.ArtifactUtils; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
public void execute()
{
    org.apache.maven.artifact.Artifact artifact =
        artifactFactory.createArtifact( getProject().getGroupId(), getProject().getArtifactId(), "", "", "" );
    try
    {
        ArtifactVersion releasedVersion = null;
        List<ArtifactVersion> versions =
            artifactMetadataSource.retrieveAvailableVersions( artifact, localRepository,
                                                              remoteArtifactRepositories );
        for ( ArtifactVersion version : versions )
        {
            if ( !ArtifactUtils.isSnapshot( version.toString() )
                && ( releasedVersion == null || version.compareTo( releasedVersion ) > 0 ) )
            {
                releasedVersion = version;
            }
        }

        if ( releasedVersion != null )
        {
            // Use ArtifactVersion.toString(), the major, minor and incrementalVersion return all an int.
            String releasedVersionValue = releasedVersion.toString();

            // This would not always reflect the expected version.
            int dashIndex = releasedVersionValue.indexOf( '-' );
            if ( dashIndex >= 0 )
            {
                releasedVersionValue = releasedVersionValue.substring( 0, dashIndex );
            }

            defineVersionProperty( "version", releasedVersionValue );
            defineVersionProperty( "majorVersion", releasedVersion.getMajorVersion() );
            defineVersionProperty( "minorVersion", releasedVersion.getMinorVersion() );
            defineVersionProperty( "incrementalVersion", releasedVersion.getIncrementalVersion() );
            defineVersionProperty( "buildNumber", releasedVersion.getBuildNumber() );
            defineVersionProperty( "qualifier", releasedVersion.getQualifier() );
        }

    }
    catch ( ArtifactMetadataRetrievalException e )
    {
        if ( getLog().isWarnEnabled() )
        {
            getLog().warn( "Failed to retrieve artifacts metadata, cannot resolve the released version" );
        }
    }
}
 
开发者ID:mojohaus,项目名称:build-helper-maven-plugin,代码行数:50,代码来源:ReleasedVersionMojo.java


注:本文中的org.apache.maven.artifact.ArtifactUtils.isSnapshot方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。