/** * {@inheritDoc} */ public void includeArtifact( Artifact artifact ) { log( "includeArtifact: artifact=" + artifact ); DependencyNode existingNode = getNode( artifact ); /* * Ignore duplicate includeArtifact calls since omitForNearer can be called prior to includeArtifact on the same * artifact, and we don't wish to include it twice. */ if ( existingNode == null && isCurrentNodeIncluded() ) { DependencyNode node = addNode( artifact ); /* * Add the dependency management information cached in any prior manageArtifact calls, since includeArtifact * is always called after manageArtifact. */ flushDependencyManagement( node ); } }
/** * {@inheritDoc} */ public void omitForCycle( Artifact artifact ) { log( "omitForCycle: artifact=" + artifact ); if ( isCurrentNodeIncluded() ) { DependencyNode node = createNode( artifact ); node.omitForCycle(); } }
/** * {@inheritDoc} */ public void manageArtifact( Artifact artifact, Artifact replacement ) { // TODO: remove when ResolutionListenerForDepMgmt merged into ResolutionListener log( "manageArtifact: artifact=" + artifact + ", replacement=" + replacement ); if ( replacement.getVersion() != null ) { manageArtifactVersion( artifact, replacement ); } if ( replacement.getScope() != null ) { manageArtifactScope( artifact, replacement ); } }
/** * {@inheritDoc} */ public void updateScopeCurrentPom( Artifact artifact, String scopeIgnored ) { log( "updateScopeCurrentPom: artifact=" + artifact + ", scopeIgnored=" + scopeIgnored ); DependencyNode node = getNode( artifact ); if ( node == null ) { // updateScopeCurrentPom events can be received prior to includeArtifact events node = addNode( artifact ); // TODO remove the node that tried to impose its scope and add some info } node.setFailedUpdateScope( scopeIgnored ); }
log( "omitForNearer: omitted=" + omitted + " kept=" + kept ); if ( isCurrentNodeIncluded() ) DependencyNode omittedNode = getNode( omitted ); removeNode( omitted ); omittedNode = createNode( omitted ); flushDependencyManagement( omittedNode ); DependencyNode keptNode = getNode( kept ); addNode( kept );
/** * {@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() ); } }
/** * {@inheritDoc} */ public void restrictRange( Artifact artifact, Artifact replacement, VersionRange versionRange ) { log( "restrictRange: artifact=" + artifact + ", replacement=" + replacement + ", versionRange=" + versionRange ); // TODO: track range restriction in node (MNG-3093) }
/** * {@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( replacement.getId(), artifact.getVersion() ); } }
/** * Creates a new dependency node for the specified artifact, appends it to the current parent dependency node and * puts it into the dependency node cache. * * @param artifact the attached artifact for the new dependency node * @return the new dependency node */ // package protected for unit test DependencyNode addNode( Artifact artifact ) { DependencyNode node = createNode( artifact ); DependencyNode previousNode = nodesByArtifact.put( node.getArtifact(), node ); if ( previousNode != null ) { throw new IllegalStateException( "Duplicate node registered for artifact: " + node.getArtifact() ); } if ( rootNode == null ) { rootNode = node; } currentNode = node; return node; }
throws DependencyTreeBuilderException DependencyTreeResolutionListener listener = new DependencyTreeResolutionListener( getLogger() ); Collections.singletonList( (ResolutionListener) listener ) ); return listener.getRootNode();
log( "omitForNearer: omitted=" + omitted + " kept=" + kept ); if ( isCurrentNodeIncluded() ) DependencyNode omittedNode = getNode( omitted ); removeNode( omitted ); omittedNode = createNode( omitted ); flushDependencyManagement( omittedNode ); DependencyNode keptNode = getNode( kept ); addNode( kept );
/** * {@inheritDoc} */ public void updateScopeCurrentPom( Artifact artifact, String scopeIgnored ) { log( "updateScopeCurrentPom: artifact=" + artifact + ", scopeIgnored=" + scopeIgnored ); DependencyNode node = getNode( artifact ); if ( node == null ) { // updateScopeCurrentPom events can be received prior to includeArtifact events node = addNode( artifact ); // TODO remove the node that tried to impose its scope and add some info } node.setFailedUpdateScope( scopeIgnored ); }
/** * {@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() ); } }
/** * {@inheritDoc} */ public void testArtifact( Artifact artifact ) { log( "testArtifact: artifact=" + artifact ); }
/** * {@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( replacement.getId(), artifact.getScope() ); } }
/** * Creates a new dependency node for the specified artifact, appends it to the current parent dependency node and * puts it into the dependency node cache. * * @param artifact * the attached artifact for the new dependency node * @return the new dependency node */ // package protected for unit test DependencyNode addNode( Artifact artifact ) { DependencyNode node = createNode( artifact ); DependencyNode previousNode = ( DependencyNode ) nodesByArtifact.put( node.getArtifact(), node ); if ( previousNode != null ) { throw new IllegalStateException( "Duplicate node registered for artifact: " + node.getArtifact() ); } if ( rootNode == null ) { rootNode = node; } currentNode = node; return node; }
/** * {@inheritDoc} */ public void includeArtifact( Artifact artifact ) { log( "includeArtifact: artifact=" + artifact ); DependencyNode existingNode = getNode( artifact ); /* * Ignore duplicate includeArtifact calls since omitForNearer can be called prior to includeArtifact on the same * artifact, and we don't wish to include it twice. */ if ( existingNode == null && isCurrentNodeIncluded() ) { DependencyNode node = addNode( artifact ); /* * Add the dependency management information cached in any prior manageArtifact calls, since includeArtifact * is always called after manageArtifact. */ flushDependencyManagement( node ); } }
/** * {@inheritDoc} */ public void updateScope( Artifact artifact, String scope ) { log( "updateScope: artifact=" + artifact + ", scope=" + scope ); DependencyNode node = getNode( artifact ); if ( node == null ) { // updateScope events can be received prior to includeArtifact events node = addNode( artifact ); } node.setOriginalScope( artifact.getScope() ); }
/** * {@inheritDoc} */ public void omitForCycle( Artifact artifact ) { log( "omitForCycle: artifact=" + artifact ); if ( isCurrentNodeIncluded() ) { DependencyNode node = createNode( artifact ); node.omitForCycle(); } }
/** * {@inheritDoc} */ public void manageArtifact( Artifact artifact, Artifact replacement ) { // TODO: remove when ResolutionListenerForDepMgmt merged into ResolutionListener log( "manageArtifact: artifact=" + artifact + ", replacement=" + replacement ); if ( replacement.getVersion() != null ) { manageArtifactVersion( artifact, replacement ); } if ( replacement.getScope() != null ) { manageArtifactScope( artifact, replacement ); } }