Package org.apache.maven.artifact.versioning

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


    public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 )
    {
        try
        {
            ArtifactVersion version1 = node1.getArtifact().getSelectedVersion();
            ArtifactVersion version2 = node2.getArtifact().getSelectedVersion();

            return version1.compareTo( version2 ) > 0 ? node1 : node2;
        }
        catch ( OverConstrainedVersionException exception )
        {
View Full Code Here


    public ResolutionNode resolveConflict( ResolutionNode node1, ResolutionNode node2 )
    {
        try
        {
            ArtifactVersion version1 = node1.getArtifact().getSelectedVersion();
            ArtifactVersion version2 = node2.getArtifact().getSelectedVersion();

            return version1.compareTo( version2 ) <= 0 ? node1 : node2;
        }
        catch ( OverConstrainedVersionException exception )
        {
View Full Code Here

            {
                Artifact artifact = node.getArtifact();
                if ( artifact.getVersion() == null )
                {
                    // set the recommended version
                    ArtifactVersion selected = artifact.getSelectedVersion();
                    // MNG-2123: null is a valid response to getSelectedVersion, don't
                    // assume it won't ever be.
                    if ( selected != null )
                    {
                        artifact.selectVersion( selected.toString() );
                    }
                    else
                    {
                        throw new OverConstrainedVersionException( "Unable to get a selected Version for "
                            + artifact.getArtifactId(), artifact );
View Full Code Here

                    try {
                        if (artifact.getVersion() == null) {
                            // set the recommended version
                            // TODO: maybe its better to just pass the range
                            // through to retrieval and use a transformation?
                            ArtifactVersion version;
                            version = getArtifactVersion(localRepository, remoteRepositories, source, artifact);

                            artifact.selectVersion(version.toString());
                            fireEvent(ResolutionListener.SELECT_VERSION_FROM_RANGE,
                                    listeners, child);
                        }

                        ResolutionGroup rGroup = source.retrieve(artifact,
View Full Code Here

            ArtifactRepository localRepository,
            List remoteRepositories,
            ArtifactMetadataSource source,
            Artifact artifact) throws OverConstrainedVersionException,
            ArtifactMetadataRetrievalException {
        ArtifactVersion version;
        if (!artifact.isSelectedVersionKnown()) {
            List versions = artifact.getAvailableVersions();
            if (versions == null) {
                versions = source.retrieveAvailableVersions(
                        artifact, localRepository,
View Full Code Here

                        getLogger().debug( "Trying " + vr );
                        try
                        {
                            List versions = artifactMetadataSource.retrieveAvailableVersions( artifact, localRepository,
                                                                                              project.getPluginArtifactRepositories() );
                            ArtifactVersion v = vr.matchVersion( versions );
                            artifactVersion = v != null ? v.toString() : null;
                        }
                        catch ( ArtifactMetadataRetrievalException e )
                        {
                            throw new PluginVersionResolutionException( groupId, artifactId,
                                                                        "Error getting available plugin versions: " +
View Full Code Here

        if ( this.testNgVersion != null )
        {
            goals1.add( "-DtestNgVersion=" + testNgVersion );

            ArtifactVersion v = new DefaultArtifactVersion( testNgVersion );
            try
            {
                if ( VersionRange.createFromVersionSpec( "(,5.12.1)" ).containsVersion( v ) )
                {
                    goals1.add( "-DtestNgClassifier=jdk15" );
View Full Code Here

                    {
                        if ( artifact.getVersion() == null )
                        {
                            // set the recommended version
                            // TODO: maybe its better to just pass the range through to retrieval and use a transformation?
                            ArtifactVersion version;
                            if ( !artifact.isSelectedVersionKnown() )
                            {
                                List versions = artifact.getAvailableVersions();
                                if ( versions == null )
                                {
                                    versions = source.retrieveAvailableVersions( artifact, localRepository,
                                                                                 remoteRepositories );
                                    artifact.setAvailableVersions( versions );
                                }

                                VersionRange versionRange = artifact.getVersionRange();

                                version = versionRange.matchVersion( versions );

                                if ( version == null )
                                {
                                    if ( versions.isEmpty() )
                                    {
                                        throw new OverConstrainedVersionException(
                                            "No versions are present in the repository for the artifact with a range " +
                                                versionRange, artifact, remoteRepositories );
                                    }
                                    else
                                    {
                                        throw new OverConstrainedVersionException( "Couldn't find a version in " +
                                            versions + " to match range " + versionRange, artifact,
                                                                                          remoteRepositories );
                                    }
                                }
                            }
                            else
                            {
                                version = artifact.getSelectedVersion();
                            }

                            artifact.selectVersion( version.toString() );
                            fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, child );
                        }

                        artifact.setDependencyTrail( node.getDependencyTrail() );
                        ResolutionGroup rGroup = source.retrieve( artifact, localRepository, remoteRepositories );
View Full Code Here

                        getLogger().debug( "Trying " + vr );
                        try
                        {
                            List versions = artifactMetadataSource.retrieveAvailableVersions( artifact, localRepository,
                                                                                              project.getPluginArtifactRepositories() );
                            ArtifactVersion v = vr.matchVersion( versions );
                            artifactVersion = v != null ? v.toString() : null;
                        }
                        catch ( ArtifactMetadataRetrievalException e )
                        {
                            throw new PluginVersionResolutionException( groupId, artifactId,
                                                                        "Error getting available plugin versions: " +
View Full Code Here

        if (previousVersion == null) {
        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;
                }
            }
        } catch (ArtifactMetadataRetrievalException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
        getLog().debug("Previous release = " + latest);
            previousVersion = latest == null ? null : latest.toString();
        }

        Map<GroupArtifactId, String> addedDeps = new LinkedHashMap<GroupArtifactId, String>();
        Map<GroupArtifactId, String> removedDeps = new LinkedHashMap<GroupArtifactId, String>();
        Map<GroupArtifactId, String> unchangedDeps = new LinkedHashMap<GroupArtifactId, String>();
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.