Java Code Examples for org.codehaus.mojo.versions.api.PomHelper#setDependencyVersion()

The following examples show how to use org.codehaus.mojo.versions.api.PomHelper#setDependencyVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UseReleasesMojo.java    From versions-maven-plugin with Apache License 2.0 6 votes vote down vote up
private void noRangeMatching( ModifiedPomXMLEventReader pom, Dependency dep, String version, String releaseVersion,
                              ArtifactVersions versions )
    throws XMLStreamException
{
    if ( versions.containsVersion( releaseVersion ) )
    {
        if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version, releaseVersion,
                                             getProject().getModel() ) )
        {
            getLog().info( "Updated " + toString( dep ) + " to version " + releaseVersion );
        }
    }
    else if ( failIfNotReplaced )
    {
        throw new NoSuchElementException( "No matching release of " + toString( dep ) + " found for update." );
    }
}
 
Example 2
Source File: LockSnapshotsMojo.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
private void lockSnapshots( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException
{
    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        if ( !isIncluded( this.toArtifact( dep ) ) )
        {
            continue;
        }

        String version = dep.getVersion();
        Matcher versionMatcher = matchSnapshotRegex.matcher( version );
        if ( versionMatcher.find() && versionMatcher.end() == version.length() )
        {
            String lockedVersion = resolveSnapshotVersion( dep );
            if ( !version.equals( lockedVersion ) )
            {
                if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
                                                     lockedVersion, getProject().getModel() ) )
                {
                    getLog().info( "Locked " + toString( dep ) + " to version " + lockedVersion );
                }
            }
        }
    }
}
 
Example 3
Source File: UseReactorMojo.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
private void useReactor( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{

    for ( Dependency dep : dependencies )
    {
        Artifact artifact = this.toArtifact( dep );
        if ( !isIncluded( artifact ) )
        {
            continue;
        }

        for ( Object reactorProject : reactorProjects )
        {
            MavenProject project = (MavenProject) reactorProject;
            if ( StringUtils.equals( project.getGroupId(), dep.getGroupId() )
                && StringUtils.equals( project.getArtifactId(), dep.getArtifactId() )
                && !StringUtils.equals( project.getVersion(), dep.getVersion() ) )
            {
                if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), dep.getVersion(),
                                                     project.getVersion(), getProject().getModel() ) )
                {
                    getLog().info( "Updated " + toString( dep ) + " to version " + project.getVersion() );
                }
                break;
            }
        }
    }
}
 
Example 4
Source File: UseReleasesMojo.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
private void rangeMatching( ModifiedPomXMLEventReader pom, Dependency dep, String version, String releaseVersion,
                            ArtifactVersions versions )
    throws XMLStreamException
{
    ArtifactVersion finalVersion = null;
    for ( ArtifactVersion proposedVersion : versions.getVersions( false ) )
    {
        if ( proposedVersion.toString().startsWith( releaseVersion ) )
        {
            getLog().debug( "Found matching version for " + toString( dep ) + " to version " + releaseVersion );
            finalVersion = proposedVersion;
        }
    }

    if ( finalVersion != null )
    {
        if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
                                             finalVersion.toString(), getProject().getModel() ) )
        {
            getLog().info( "Updated " + toString( dep ) + " to version " + finalVersion.toString() );
        }
    }
    else
    {
        getLog().info( "No matching release of " + toString( dep ) + " to update via rangeMatching." );
        if ( failIfNotReplaced )
        {
            throw new NoSuchElementException( "No matching release of " + toString( dep )
                + " found for update via rangeMatching." );
        }
    }
}
 
Example 5
Source File: UnlockSnapshotsMojo.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
private void unlockSnapshots( ModifiedPomXMLEventReader pom, List<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException
{
    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        if ( !isIncluded( this.toArtifact( dep ) ) )
        {
            continue;
        }

        String version = dep.getVersion();
        Matcher versionMatcher = matchSnapshotRegex.matcher( version );
        if ( versionMatcher.find() && versionMatcher.end() == version.length() )
        {
            String unlockedVersion = versionMatcher.replaceFirst( "-SNAPSHOT" );
            if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), dep.getVersion(),
                                                 unlockedVersion, getProject().getModel() ) )
            {
                getLog().info( "Unlocked " + toString( dep ) + " to version " + unlockedVersion );
            }
        }
    }
}
 
Example 6
Source File: DependencyVersionChanger.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
public void apply( VersionChange versionChange )
    throws XMLStreamException
{
    if ( PomHelper.setDependencyVersion( getPom(), versionChange.getGroupId(), versionChange.getArtifactId(),
                                         versionChange.getOldVersion(), versionChange.getNewVersion(),
                                         getModel() ) )
    {
        info( "    Updating dependency " + versionChange.getGroupId() + ":" + versionChange.getArtifactId() );
        info( "        from version " + versionChange.getOldVersion() + " to " + versionChange.getNewVersion() );
    }
}
 
Example 7
Source File: UseNextVersionsMojo.java    From versions-maven-plugin with Apache License 2.0 5 votes vote down vote up
private void useNextVersions( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{
    for ( Dependency dep : dependencies ) {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        String version = dep.getVersion();
        Artifact artifact = this.toArtifact( dep );
        if ( !isIncluded( artifact ) )
        {
            continue;
        }

        getLog().debug( "Looking for newer versions of " + toString( dep ) );
        ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );
        ArtifactVersion[] newer = versions.getNewerVersions( version, Boolean.TRUE.equals( allowSnapshots ) );
        if ( newer.length > 0 )
        {
            String newVersion = newer[0].toString();
            if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version, newVersion,
                                                 getProject().getModel() ) )
            {
                getLog().info( "Updated " + toString( dep ) + " to version " + newVersion );
            }
        }
    }
}
 
Example 8
Source File: UseNextSnapshotsMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void useNextSnapshots( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{
    int segment = determineUnchangedSegment( allowMajorUpdates, allowMinorUpdates, allowIncrementalUpdates );

    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        String version = dep.getVersion();
        Matcher versionMatcher = matchSnapshotRegex.matcher( version );
        if ( !versionMatcher.matches() )
        {
            getLog().debug( "Looking for next snapshot of " + toString( dep ) );
            Artifact artifact = this.toArtifact( dep );
            if ( !isIncluded( artifact ) )
            {
                continue;
            }

            ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );
            final VersionComparator versionComparator = versions.getVersionComparator();
            final DefaultArtifactVersion lowerBound = new DefaultArtifactVersion( version );
            if ( segment + 1 > versionComparator.getSegmentCount( lowerBound ) )
            {
                getLog().info( "Ignoring " + toString( dep ) + " as the version number is too short" );
                continue;
            }
            ArtifactVersion upperBound =
                segment >= 0 ? versionComparator.incrementSegment(lowerBound, segment) : null;
            getLog().info( "Upper bound: " + (upperBound == null ? "none" : upperBound.toString() ) );
            ArtifactVersion[] newer = versions.getVersions( lowerBound, upperBound, true, false, false );
            getLog().debug( "Candidate versions " + Arrays.asList( newer ) );
            for ( int j = 0; j < newer.length; j++ )
            {
                String newVersion = newer[j].toString();
                if ( matchSnapshotRegex.matcher( newVersion ).matches() )
                {
                    if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
                                                         newVersion, getProject().getModel() ) )
                    {
                        getLog().info( "Updated " + toString( dep ) + " to version " + newVersion );
                    }
                    break;
                }
            }
        }
    }
}
 
Example 9
Source File: ForceReleasesMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void useReleases( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{
    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        String version = dep.getVersion();
        Matcher versionMatcher = matchSnapshotRegex.matcher( version );
        if ( versionMatcher.matches() )
        {
            String releaseVersion = versionMatcher.group( 1 );
            Artifact artifact = this.toArtifact( dep );
            if ( !isIncluded( artifact ) )
            {
                continue;
            }

            getLog().debug( "Looking for a release of " + toString( dep ) );
            ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );
            if ( versions.containsVersion( releaseVersion ) )
            {
                if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
                                                     releaseVersion, getProject().getModel() ) )
                {
                    getLog().info( "Updated " + toString( dep ) + " to version " + releaseVersion );
                }
            }
            else
            {
                ArtifactVersion[] v = versions.getVersions( false );
                if ( v.length == 0 )
                {
                    getLog().info( "No release of " + toString( dep ) + " to force." );
                }
                else if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
                                                          v[v.length - 1].toString(), getProject().getModel() ) )
                {
                    getLog().info( "Reverted " + toString( dep ) + " to version " + v[v.length - 1].toString() );
                }
            }
        }
    }
}
 
Example 10
Source File: UseNextReleasesMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void useNextReleases( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{
    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        String version = dep.getVersion();
        Matcher versionMatcher = matchSnapshotRegex.matcher( version );
        if ( !versionMatcher.matches() )
        {
            getLog().debug( "Looking for newer versions of " + toString( dep ) );
            Artifact artifact = this.toArtifact( dep );
            if ( !isIncluded( artifact ) )
            {
                continue;
            }

            ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );
            ArtifactVersion[] newer = versions.getNewerVersions( version, false );
            if ( newer.length > 0 )
            {
                String newVersion = newer[0].toString();
                if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
                                                     newVersion, getProject().getModel() ) )

                {
                    getLog().info( "Updated " + toString( dep ) + " to version " + newVersion );
                }
            }
        }
    }
}
 
Example 11
Source File: ResolveRangesMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void resolveRanges( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{

    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        Matcher versionMatcher = matchRangeRegex.matcher( dep.getVersion() );

        if ( versionMatcher.find() )
        {
            Artifact artifact = this.toArtifact( dep );

            if ( artifact != null && isIncluded( artifact ) )
            {
                getLog().debug( "Resolving version range for dependency: " + artifact );

                String artifactVersion = artifact.getVersion();
                if ( artifactVersion == null )
                {
                    ArtifactVersion latestVersion =
                        findLatestVersion( artifact, artifact.getVersionRange(), allowSnapshots, false );

                    if ( latestVersion != null )
                    {
                        artifactVersion = latestVersion.toString();
                    }
                    else
                    {
                        getLog().warn( "Not updating version " + artifact + " : could not resolve any versions" );
                    }
                }

                if ( artifactVersion != null )
                {
                    if ( PomHelper.setDependencyVersion( pom, artifact.getGroupId(), artifact.getArtifactId(),
                                                         dep.getVersion(), artifactVersion,
                                                         getProject().getModel() ) )
                    {
                        getLog().debug( "Version set to " + artifactVersion + " for dependency: " + artifact );
                    }
                    else
                    {
                        getLog().debug( "Could not find the version tag for dependency " + artifact + " in project "
                            + getProject().getId() + " so unable to set version to " + artifactVersion );
                    }
                }
            }
        }
    }
}
 
Example 12
Source File: CompareDependenciesMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
/**
 * Compare the dependency versions of the current project with the dependency versions of a remote project
 *
 * @throws XMLStreamException
 */
private List<String> compareVersions( ModifiedPomXMLEventReader pom, List<Dependency> dependencies,
                                      Map<String, Dependency> remoteDependencies )
    throws MojoExecutionException, XMLStreamException
{
    List<String> updates = new ArrayList<>();
    for ( Dependency dep : dependencies )
    {
        Artifact artifact = this.toArtifact( dep );
        if ( !isIncluded( artifact ) )
        {
            continue;
        }

        Dependency remoteDep = remoteDependencies.get( dep.getManagementKey() );
        if ( remoteDep != null )
        {
            String remoteVersion = remoteDep.getVersion();

            if ( !dep.getVersion().equals( remoteVersion ) )
            {
                StringBuilder buf = writeDependencyDiffMessage( dep, remoteVersion );
                updates.add( buf.toString() );
                if ( !reportMode )
                {
                    if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(),
                                                         dep.getVersion(), remoteVersion,
                                                         getProject().getModel() ) )
                    {
                        getLog().info( "Updated " + toString( dep ) + " to version " + remoteVersion );
                    }
                }

            }

        }
    }

    return updates;

}
 
Example 13
Source File: UseDepVersionMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void useDepVersion( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws MojoExecutionException, XMLStreamException, ArtifactMetadataRetrievalException
{
    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        Artifact artifact = this.toArtifact( dep );

        if ( isIncluded( artifact ) )
        {
            if ( !forceVersion )
            {
                ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );

                if ( !versions.containsVersion( depVersion ) )
                {
                    throw new MojoExecutionException( String.format( "Version %s is not available for artifact %s:%s",
                                                                     depVersion, artifact.getGroupId(),
                                                                     artifact.getArtifactId() ) );
                }
            }

            String version = dep.getVersion();

            if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version, depVersion,
                                                 getProject().getModel() ) )
            {
                getLog().info( "Updated " + toString( dep ) + " to version " + depVersion );
            }
        }
    }
}
 
Example 14
Source File: UseLatestVersionsMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void useLatestVersions( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{
    int segment = determineUnchangedSegment( allowMajorUpdates, allowMinorUpdates, allowIncrementalUpdates );
    MajorMinorIncrementalFilter majorMinorIncfilter =
        new MajorMinorIncrementalFilter( allowMajorUpdates, allowMinorUpdates, allowIncrementalUpdates );

    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        String version = dep.getVersion();
        Artifact artifact = this.toArtifact( dep );
        if ( !isIncluded( artifact ) )
        {
            continue;
        }

        ArtifactVersion selectedVersion = new DefaultArtifactVersion( version );
        getLog().debug( "Selected version:" + selectedVersion.toString() );

        getLog().debug( "Looking for newer versions of " + toString( dep ) );
        ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );

        ArtifactVersion[] newerVersions = versions.getNewerVersions( version, segment, allowSnapshots );

        ArtifactVersion[] filteredVersions = majorMinorIncfilter.filter( selectedVersion, newerVersions );
        if ( filteredVersions.length > 0 )
        {
            String newVersion = filteredVersions[filteredVersions.length - 1].toString();
            if ( getProject().getParent() != null )
            {
                if ( artifact.getId().equals( getProject().getParentArtifact().getId() ) && isProcessingParent() )
                {
                    if ( PomHelper.setProjectParentVersion( pom, newVersion ) ) {
                        getLog().debug("Made parent update from " + version + " to " + newVersion);
                    }
                }
            }
            if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version, newVersion,
                                                 getProject().getModel() ) ) {
                getLog().info( "Updated " + toString( dep ) + " to version " + newVersion );

            }
        }

    }
}
 
Example 15
Source File: UseLatestReleasesMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void useLatestReleases( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{
    int segment = determineUnchangedSegment( allowMajorUpdates, allowMinorUpdates, allowIncrementalUpdates );
    MajorMinorIncrementalFilter majorMinorIncfilter =
        new MajorMinorIncrementalFilter( allowMajorUpdates, allowMinorUpdates, allowIncrementalUpdates );

    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        String version = dep.getVersion();
        Matcher versionMatcher = matchSnapshotRegex.matcher( version );
        if ( !versionMatcher.matches() )
        {
            Artifact artifact = this.toArtifact( dep );
            if ( !isIncluded( artifact ) )
            {
                continue;
            }

            ArtifactVersion selectedVersion = new DefaultArtifactVersion( version );
            getLog().debug( "Selected version:" + selectedVersion.toString() );

            getLog().debug( "Looking for newer versions of " + toString( dep ) );
            ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );
            ArtifactVersion[] newer = versions.getNewerVersions( version, segment, false );
            newer = filterVersionsWithIncludes( newer, artifact );

            ArtifactVersion[] filteredVersions = majorMinorIncfilter.filter( selectedVersion, newer );
            if ( filteredVersions.length > 0 )
            {
                String newVersion = filteredVersions[filteredVersions.length - 1].toString();
                if ( getProject().getParent() != null )
                {
                    if ( artifact.getId().equals( getProject().getParentArtifact().getId() ) && isProcessingParent() )
                    {
                        if ( PomHelper.setProjectParentVersion( pom, newVersion.toString() ) )
                        {
                            getLog().debug( "Made parent update from " + version + " to " + newVersion.toString() );
                        }
                    }
                }
                if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
                                                     newVersion, getProject().getModel() ) )
                {
                    getLog().info( "Updated " + toString( dep ) + " to version " + newVersion );
                }
            }
        }
    }
}
 
Example 16
Source File: UseLatestSnapshotsMojo.java    From versions-maven-plugin with Apache License 2.0 4 votes vote down vote up
private void useLatestSnapshots( ModifiedPomXMLEventReader pom, Collection<Dependency> dependencies )
    throws XMLStreamException, MojoExecutionException, ArtifactMetadataRetrievalException
{
    int segment = determineUnchangedSegment( allowMajorUpdates, allowMinorUpdates, allowIncrementalUpdates );
    MajorMinorIncrementalFilter majorMinorIncfilter =
            new MajorMinorIncrementalFilter( allowMajorUpdates, allowMinorUpdates, allowIncrementalUpdates );

    for ( Dependency dep : dependencies )
    {
        if ( isExcludeReactor() && isProducedByReactor( dep ) )
        {
            getLog().info( "Ignoring reactor dependency: " + toString( dep ) );
            continue;
        }

        if ( isHandledByProperty( dep ) )
        {
            getLog().debug( "Ignoring dependency with property as version: " + toString( dep ) );
            continue;
        }

        String version = dep.getVersion();
        Matcher versionMatcher = matchSnapshotRegex.matcher(version);
        if ( !versionMatcher.matches() )
        {
            getLog().debug( "Looking for latest snapshot of " + toString( dep ) );
            Artifact artifact = this.toArtifact( dep );
            if ( !isIncluded( artifact ) )
            {
                continue;
            }

            ArtifactVersion selectedVersion = new DefaultArtifactVersion( version );

            ArtifactVersions versions = getHelper().lookupArtifactVersions( artifact, false );
            final VersionComparator versionComparator = versions.getVersionComparator();
            final DefaultArtifactVersion lowerBound = new DefaultArtifactVersion( version );
            if ( segment + 1 > versionComparator.getSegmentCount( lowerBound ) )
            {
                getLog().info( "Ignoring " + toString( dep ) + " as the version number is too short" );
                continue;
            }
            ArtifactVersion upperBound =
                segment >= 0 ? versionComparator.incrementSegment( lowerBound, segment ) : null;
            getLog().info( "Upper bound: " + (upperBound == null ? "none" : upperBound.toString() ) );
            ArtifactVersion[] newer = versions.getVersions( lowerBound, upperBound, true, false, false );
            getLog().debug( "Candidate versions " + Arrays.asList( newer ) );

            String latestVersion = null;
            ArrayList snapshotsOnly = new ArrayList();

            for ( int j = 0; j < newer.length; j++ )
            {
                String newVersion = newer[j].toString();
                if ( matchSnapshotRegex.matcher( newVersion ).matches() )
                {
                    snapshotsOnly.add( newer[j] );
                }
            }
            getLog().debug("Snapshot Only versions " + snapshotsOnly.toString());

            ArtifactVersion[] filteredVersions = majorMinorIncfilter.filter( selectedVersion,
                                                                            (ArtifactVersion[]) snapshotsOnly.toArray(
                                                                                new ArtifactVersion[snapshotsOnly.size()] ) );
            getLog().debug( "Filtered versions " + Arrays.asList( filteredVersions ) );


            if ( filteredVersions.length > 0 )
            {
                latestVersion = filteredVersions[filteredVersions.length - 1].toString();
                if ( getProject().getParent() != null )
                {
                    if ( artifact.getId().equals(getProject().getParentArtifact().getId()) && isProcessingParent() )
                    {
                        if ( PomHelper.setProjectParentVersion( pom, latestVersion.toString() ) )
                        {
                            getLog().debug( "Made parent update from " + version + " to " + latestVersion.toString() );
                        }
                    }
                }

                if ( PomHelper.setDependencyVersion( pom, dep.getGroupId(), dep.getArtifactId(), version,
                                                     latestVersion, getProject().getModel() ) )
                {
                    getLog().info( "Updated " + toString( dep ) + " to version " + latestVersion );
                }
            }
        }
    }
}