Package org.apache.maven.artifact.versioning

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


        // FIXME: need to find out how a plugin gets marked as 'installed'
        // and no ChildContainer exists. The check for that below fixes
        // the 'Can't find plexus container for plugin: xxx' error.
        try
        {
            VersionRange versionRange = VersionRange.createFromVersionSpec( plugin.getVersion() );

            List remoteRepositories = new ArrayList();
            remoteRepositories.addAll( project.getPluginArtifactRepositories() );
            remoteRepositories.addAll( project.getRemoteArtifactRepositories() );
View Full Code Here


        // Maven uses is hidden from downstream use. We will also bump up any
        // anything below 1.1 to 1.1 as this mimics the behaviour in 2.0.5 where
        // plexus-utils 1.1 was being forced into use.
        // ----------------------------------------------------------------------------

        VersionRange vr = null;

        try
        {
            vr = VersionRange.createFromVersionSpec( "[1.1,)" );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            // Won't happen
        }

        boolean plexusUtilsPresent = false;

        for ( Iterator i = resolutionGroup.getArtifacts().iterator(); i.hasNext(); )
        {
            Artifact a = (Artifact) i.next();

            if ( a.getArtifactId().equals( "plexus-utils" ) &&
                vr.containsVersion( new DefaultArtifactVersion( a.getVersion() ) ) )
            {
                plexusUtilsPresent = true;

                break;
            }
View Full Code Here

                scope = Artifact.SCOPE_COMPILE;

                d.setScope( scope );
            }

            VersionRange versionRange;
            try
            {
                versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
            }
            catch ( InvalidVersionSpecificationException e )
View Full Code Here

        return artifactMap;
    }

    public static Artifact copyArtifact( Artifact artifact )
    {
        VersionRange range = artifact.getVersionRange();
        DefaultArtifact clone = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), range.cloneOf(),
                                                     artifact.getScope(), artifact.getType(), artifact.getClassifier(),
                                                     artifact.getArtifactHandler(), artifact.isOptional() );
        clone.setRelease( artifact.isRelease() );
        clone.setResolvedVersion( artifact.getVersion() );
        clone.setResolved( artifact.isResolved() );
View Full Code Here

                scope = Artifact.SCOPE_COMPILE;

                dependency.setScope( scope );
            }

            VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() );
            Artifact artifact =
                factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange,
                                                  dependency.getType(), dependency.getClassifier(), scope, null,
                                                  dependency.isOptional() );
View Full Code Here

            map = new ManagedVersionMap( map );

            for ( Dependency dependency : dependencyManagement.getDependencies() )
            {

                VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() );

                Artifact artifact =
                    factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange,
                                                      dependency.getType(), dependency.getClassifier(),
                                                      dependency.getScope(), dependency.isOptional() );
View Full Code Here

    private static String getConfiguratorName( ArtifactVersion version )
        throws MojoExecutionException
    {
        try
        {
            VersionRange range = VersionRange.createFromVersionSpec( "[4.7,5.1]" );
            if ( range.containsVersion( version ) )
            {
                return "org.apache.maven.surefire.testng.conf.TestNG4751Configurator";
            }
            range = VersionRange.createFromVersionSpec( "[5.2]" );
            if ( range.containsVersion( version ) )
            {
                return "org.apache.maven.surefire.testng.conf.TestNG52Configurator";
            }
            range = VersionRange.createFromVersionSpec( "[5.3,6.4]" );
            if ( range.containsVersion( version ) )
            {
                return "org.apache.maven.surefire.testng.conf.TestNGMapConfigurator";
            }
            range = VersionRange.createFromVersionSpec( "[6.5,)" );
            if ( range.containsVersion( version ) )
            {
                return "org.apache.maven.surefire.testng.conf.TestNG652Configurator";
            }

            throw new MojoExecutionException( "Unknown TestNG version " + version );
View Full Code Here

    {
        Artifact artifact = getProjectArtifactMap().get( getTestNGArtifactName() );

        if ( artifact != null )
        {
            VersionRange range = createVersionRange();
            if ( !range.containsVersion( new DefaultArtifactVersion( artifact.getVersion() ) ) )
            {
                throw new MojoExecutionException(
                    "TestNG support requires version 4.7 or above. You have declared version "
                        + artifact.getVersion() );
            }
View Full Code Here

        {
            return false;
        }
        try
        {
            VersionRange range = VersionRange.createFromVersionSpec( versionSpec );
            try
            {
                return range.containsVersion( artifact.getSelectedVersion() );
            }
            catch ( NullPointerException e )
            {
                return range.containsVersion( new DefaultArtifactVersion( artifact.getBaseVersion() ) );
            }
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new RuntimeException( "Bug in plugin. Please report with stacktrace" );
View Full Code Here

            try
            {
                List<ArtifactRepository> remoteRepo = remoteArtifactRepositories;
                if ( artifact.isSnapshot() )
                {
                    VersionRange rng = VersionRange.createFromVersion( artifact.getBaseVersion() );
                    artifact =
                        artifactFactory.createDependencyArtifact( artifact.getGroupId(), artifact.getArtifactId(), rng,
                                                                  artifact.getType(), artifact.getClassifier(),
                                                                  artifact.getScope(), null, artifact.isOptional() );
                }
View Full Code Here

TOP

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

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.