Package org.apache.maven.artifact.versioning

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


        if ( StringUtils.isEmpty( mavenVersion ) )
        {
            throw new InitializationException( "Unable to read Maven version from maven-core" );
        }

        applicationVersion = new DefaultArtifactVersion( mavenVersion );
    }
View Full Code Here


                artifactVersions = new ArrayList();
                versions.put( key, artifactVersions );
            }
            if ( spec.artifact.getVersion() != null )
            {
                artifactVersions.add( new DefaultArtifactVersion( spec.artifact.getVersion() ) );
            }
        }
View Full Code Here

        int depth1 = e1.getDepth();
        int depth2 = e2.getDepth();

        if ( depth1 == depth2 )
        {
            ArtifactVersion v1 = new DefaultArtifactVersion( e1.getVersion() );
            ArtifactVersion v2 = new DefaultArtifactVersion( e2.getVersion() );

            if ( newerFirst )
            {
                return v1.compareTo( v2 ) > 0 ? e1 : e2;
            }
View Full Code Here

                        }
                    }
                    if ( result == 0 )
                    {
                        // We don't consider the version range in the comparison, just the resolved version
                        result = new DefaultArtifactVersion( version ).compareTo(
                            new DefaultArtifactVersion( a.getVersion() ) );
                    }
                }
            }
        }
        return result;
View Full Code Here

    public void execute() throws MojoExecutionException, MojoFailureException {
        getLog().debug("Looking for previous release of " + project.getGroupId() + ":" + project.getArtifactId() + ":"
                + project.getVersion());
        Artifact projectArtifact = artifactFactory
                .createProjectArtifact(project.getGroupId(), project.getArtifactId(), project.getVersion());
        ArtifactVersion projectVersion = new DefaultArtifactVersion(project.getVersion());

        ArtifactVersion latest = null;
        try {
            List<ArtifactVersion> artifactVersions = artifactMetadataSource
                    .retrieveAvailableVersions(projectArtifact, localRepository,
                            project.getRemoteArtifactRepositories());
            for (ArtifactVersion version : artifactVersions) {
                if (SNAPSHOT_PATTERN.matcher(version.toString()).find() || projectVersion.compareTo(version) <= 0) {
                    continue;
                }
                if (latest == null || latest.compareTo(version) < 0) {
                    latest = version;
                }
View Full Code Here

  private void checkVersion(String artifactName, String versionSpec, Artifact artifact)
      throws MojoExecutionException {
    VersionRange range;
    try {
      range = VersionRange.createFromVersionSpec(versionSpec);
      if (!range.containsVersion(new DefaultArtifactVersion(artifact.getVersion())))
      {
          throw new MojoExecutionException(
              "JUnit4 plugin requires " + artifactName + " in version " +
              versionSpec + " among project dependencies, you declared: "
                  + artifact.getVersion());
View Full Code Here

            // TODO: this is a workaround for a bug in DefaultArtifactVersion - fix there - it should not consider case in comparing the qualifier
            // NOTE: The combination of upper-casing and lower-casing is an approximation of String.equalsIgnoreCase()
            String thisVersion = strVersion.toUpperCase( Locale.ENGLISH ).toLowerCase( Locale.ENGLISH );
            String thatVersion = that.strVersion.toUpperCase( Locale.ENGLISH ).toLowerCase( Locale.ENGLISH );

            result = new DefaultArtifactVersion( thisVersion ).compareTo( new DefaultArtifactVersion( thatVersion ) );
        }
        return result;
    }
View Full Code Here

            {
                try
                {
                    result =
                        AbstractVersionEnforcer.containsVersion( VersionRange.createFromVersionSpec( pattern[2] ),
                                                                 new DefaultArtifactVersion( artifact.getBaseVersion() ) );
                }
                catch ( InvalidVersionSpecificationException e )
                {
                    throw new EnforcerRuleException( "Invalid Version Range: ", e );
                }
View Full Code Here

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

        ArtifactVersion detectedJdkVersion = new DefaultArtifactVersion( java_version );

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

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

        private ArtifactVersion extractArtifactVersion() {
            Artifact artifact = node.getArtifact();
            String version = artifact.getVersion();
            if (version != null) {
                return new DefaultArtifactVersion(version);
            }
            try {
                return artifact.getSelectedVersion();
            } catch (OverConstrainedVersionException e) {
                throw new RuntimeException("Version ranges problem with " + node.getArtifact(), e);
View Full Code Here

TOP

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

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.