Package org.apache.maven.artifact.versioning

Examples of org.apache.maven.artifact.versioning.ArtifactVersion


     * @return true if the version is contained by the range.
     */
    public static boolean containsVersion( VersionRange allowedRange, ArtifactVersion theVersion )
    {
        boolean matched = false;
        ArtifactVersion recommendedVersion = allowedRange.getRecommendedVersion();
        if ( recommendedVersion == null )
        {
            @SuppressWarnings( "unchecked" )
            List<Restriction> restrictions = allowedRange.getRestrictions();
            for ( Restriction restriction :  restrictions )
            {
                if ( restriction.containsVersion( theVersion ) )
                {
                    matched = true;
                    break;
                }
            }
        }
        else
        {
            // only singular versions ever have a recommendedVersion
            @SuppressWarnings( "unchecked" )
            int compareTo = recommendedVersion.compareTo( theVersion );
            matched = ( compareTo <= 0 );
        }
        return matched;
    }
View Full Code Here


        throws EnforcerRuleException
    {
        try
        {
            RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );
            ArtifactVersion detectedMavenVersion = rti.getApplicationVersion();
            helper.getLog().debug( "Detected Maven Version: " + detectedMavenVersion );
            enforceVersion( helper.getLog(), "Maven", getVersion(), detectedMavenVersion );
        }
        catch ( ComponentLookupException e )
        {
View Full Code Here

        log.debug( "Detected Java String: " + javaVersion );
        javaVersion = normalizeJDKVersion( javaVersion );
        log.debug( "Normalized Java String: " + javaVersion );

        ArtifactVersion detectedJdkVersion = new DefaultArtifactVersion( javaVersion );

        log.debug( "Parsed Version: Major: " + detectedJdkVersion.getMajorVersion() + " Minor: "
            + detectedJdkVersion.getMinorVersion() + " Incremental: " + detectedJdkVersion.getIncrementalVersion()
            + " Build: " + detectedJdkVersion.getBuildNumber() + " Qualifier: " + detectedJdkVersion.getQualifier() );

        enforceVersion( helper.getLog(), "JDK", getVersion(), detectedJdkVersion );
    }
View Full Code Here

                {
                    resolvedPair = hopPair;
                }
            }

            ArtifactVersion resolvedVersion = resolvedPair.extractArtifactVersion( uniqueVersions, false );

            for ( DependencyNodeHopCountPair pair : pairs )
            {
                ArtifactVersion version = pair.extractArtifactVersion( uniqueVersions, true );
                if ( resolvedVersion.compareTo( version ) < 0 )
                {
                    return true;
                }
            }
View Full Code Here

            if ( compileArtifactMap.get( newArtifact.getDependencyConflictId() ) != null )
            {
                Artifact oldArtifact = compileArtifactMap.get( newArtifact.getDependencyConflictId() );

                ArtifactVersion oldVersion = new DefaultArtifactVersion( oldArtifact.getVersion() );
                ArtifactVersion newVersion = new DefaultArtifactVersion( newArtifact.getVersion() );
                if ( newVersion.compareTo( oldVersion ) > 0 )
                {
                    compileArtifactMap.put( newArtifact.getDependencyConflictId(), newArtifact );
                }
            }
            else
View Full Code Here

     * @return
     */
    public static String getArtifactVersion( String[] artifactIds, List dependencies, int len )
    {
        String version = null;
        ArtifactVersion artifactVersion = getArtifactVersion( artifactIds, dependencies );
        if ( artifactVersion != null )
        {
            StringBuffer versionBuffer = new StringBuffer();
            if( len >= 1 )
            {
                versionBuffer.append( artifactVersion.getMajorVersion() );
            }
            if( len >= 2 )
            {
                versionBuffer.append( '.' );
            }           
            if( len >= 3 )
            {
                versionBuffer.append( artifactVersion.getMinorVersion() );
            }
            if( len >= 4 )
            {
                versionBuffer.append( '.' );
            }           
            if( len >= 5 )
            {
                versionBuffer.append( artifactVersion.getIncrementalVersion() );
            }
            version = versionBuffer.toString();
        }
        return version;
    }
View Full Code Here

    protected boolean isMavenVersion( String version )
    {
        try
        {
            VersionRange versionRange = VersionRange.createFromVersionSpec( version );
            ArtifactVersion mavenVersion = runtimeInformation.getApplicationVersion();
            return versionRange.containsVersion( mavenVersion );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new IllegalArgumentException( e.getMessage() );
View Full Code Here

      validateMissingBuildtimeArtifact();
      return;
    }

    // otherwise, lets make sure they match...
    ArtifactVersion projectAntlrVersion = determineArtifactVersion( antlrArtifact );
    if ( pluginAntlrVersion.compareTo( projectAntlrVersion ) != 0 ) {
      getLog().warn(
          "Encountered " + ANTLR_GROUP_ID + ':' + ANTLR_ARTIFACT_NAME + ':' + projectAntlrVersion.toString() +
              " which did not match Antlr version used by plugin [" + pluginAntlrVersion.toString() + "]"
      );
    }
  }
View Full Code Here

    if ( antlrRuntimeArtifact == null ) {
      // its possible, if the project instead depends on the build-time (or full) artifact.
      return;
    }

    ArtifactVersion projectAntlrVersion = determineArtifactVersion( antlrRuntimeArtifact );
    if ( pluginAntlrVersion.compareTo( projectAntlrVersion ) != 0 ) {
      getLog().warn(
          "Encountered " + ANTLR_GROUP_ID + ':' + ANTLR_RUNTIME_ARTIFACT_NAME + ':' + projectAntlrVersion.toString() +
              " which did not match Antlr version used by plugin [" + pluginAntlrVersion.toString() + "]"
      );
    }
  }
View Full Code Here

     */
    public void execute()
        throws MojoExecutionException, MojoFailureException
    {

        ArtifactVersion detectedMavenVersion = rti.getApplicationVersion();
        VersionRange vr;
        try
        {
            vr = VersionRange.createFromVersionSpec( "[2.0.8,)" );
            if ( !containsVersion( vr, detectedMavenVersion ) )
View Full Code Here

TOP

Related Classes of org.apache.maven.artifact.versioning.ArtifactVersion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.