/** * {@inheritDoc} */ public void manageArtifactVersion( Artifact artifact, Artifact replacement ) { log( "manageArtifactVersion: artifact=" + artifact + ", replacement=" + replacement ); /* * DefaultArtifactCollector calls manageArtifact twice: first with the change; then subsequently with no change. * We ignore the second call when the versions are equal. */ if ( isCurrentNodeIncluded() && !replacement.getVersion().equals( artifact.getVersion() ) ) { /* * Cache management information and apply in includeArtifact, since DefaultArtifactCollector mutates the * artifact and then calls includeArtifact after manageArtifact. */ managedVersions.put( getRangeId( replacement ), artifact.getVersion() ); } }
/** * Updates the specified node with any dependency management information cached in prior <code>manageArtifact</code> * calls. * * @param node * the node to update */ private void flushDependencyManagement( DependencyNode node ) { Artifact artifact = node.getArtifact(); String premanagedVersion = ( String ) managedVersions.get( getRangeId( artifact ) ); String premanagedScope = ( String ) managedScopes.get( getRangeId( artifact ) ); if ( premanagedVersion != null || premanagedScope != null ) { if ( premanagedVersion != null ) { node.setPremanagedVersion( premanagedVersion ); } if ( premanagedScope != null ) { node.setPremanagedScope( premanagedScope ); } premanagedVersion = null; premanagedScope = null; } }
/** * {@inheritDoc} */ public void manageArtifactScope( Artifact artifact, Artifact replacement ) { log( "manageArtifactScope: artifact=" + artifact + ", replacement=" + replacement ); /* * DefaultArtifactCollector calls manageArtifact twice: first with the change; then subsequently with no change. * We ignore the second call when the scopes are equal. */ if ( isCurrentNodeIncluded() && !replacement.getScope().equals( artifact.getScope() ) ) { /* * Cache management information and apply in includeArtifact, since DefaultArtifactCollector mutates the * artifact and then calls includeArtifact after manageArtifact. */ managedScopes.put( getRangeId( replacement ), artifact.getScope() ); } }