public void disable() { active = false; if ( children != null ) { for ( ResolutionNode node : children ) { node.disable(); } } }
public ResolutionNode( Artifact artifact, List<ArtifactRepository> remoteRepositories, ResolutionNode parent ) { this.artifact = artifact; this.remoteRepositories = remoteRepositories; depth = parent.depth + 1; parents = new ArrayList<>(); parents.addAll( parent.parents ); parents.add( parent.getKey() ); this.parent = parent; }
Object key = node.getKey(); if ( previous.isActive() ) VersionRange previousRange = previous.getArtifact().getVersionRange(); VersionRange currentRange = node.getArtifact().getVersionRange(); if ( newRange.isSelectedVersionKnown( previous.getArtifact() ) ) fireEvent( ResolutionListener.RESTRICT_RANGE, listeners, node, previous.getArtifact(), newRange ); previous.getArtifact().setVersionRange( newRange ); node.getArtifact().setVersionRange( currentRange.restrict( previousRange ) ); Artifact resetArtifact = resetNodes[j].getArtifact(); resetArtifact.setDependencyTrail( node.getDependencyTrail() ); throw new ArtifactResolutionException( "Unable to get dependency information: " + previous.getArtifact().getVersion() + " and " + node.getArtifact().getVersion(), previous.getArtifact() ); resolved.getArtifact() ) ); nearest.disable(); farthest.getArtifact().setVersion( nearest.getArtifact().getVersion() );
ResolutionNode root = new ResolutionNode( originatingArtifact, repositoryRequest.getRemoteRepositories() ); root.addDependencies( artifacts, repositoryRequest.getRemoteRepositories(), filter ); if ( !node.equals( root ) && node.isActive() ) Artifact artifact = node.getArtifact(); if ( node.filterTrail( filter ) ) if ( node.isChildOfRootNode() || !artifact.isOptional() ) artifact.setDependencyTrail( node.getDependencyTrail() );
int dependencyDepth = node.getDepth(); Artifact art = node.getArtifact(); artifactResolver.resolve(art, node.getRemoteRepositories(), localRepository); } catch (ArtifactNotFoundException e) { getLog().debug(e.getMessage(), e);
private void manageArtifact( ResolutionNode node, ManagedVersionMap managedVersions, List<ResolutionListener> listeners ) { Artifact artifact = managedVersions.get( node.getKey() ); // Before we update the version of the artifact, we need to know // whether we are working on a transitive dependency or not. This // allows depMgmt to always override transitive dependencies, while // explicit child override depMgmt (viz. depMgmt should only // provide defaults to children, but should override transitives). // We can do this by calling isChildOfRootNode on the current node. if ( ( artifact.getVersion() != null ) && ( !node.isChildOfRootNode() || node.getArtifact().getVersion() == null ) ) { fireEvent( ResolutionListener.MANAGE_ARTIFACT_VERSION, listeners, node, artifact ); node.getArtifact().setVersion( artifact.getVersion() ); } if ( ( artifact.getScope() != null ) && ( !node.isChildOfRootNode() || node.getArtifact().getScope() == null ) ) { fireEvent( ResolutionListener.MANAGE_ARTIFACT_SCOPE, listeners, node, artifact ); node.getArtifact().setScope( artifact.getScope() ); } if ( Artifact.SCOPE_SYSTEM.equals( node.getArtifact().getScope() ) && ( node.getArtifact().getFile() == null ) && ( artifact.getFile() != null ) ) { fireEvent( ResolutionListener.MANAGE_ARTIFACT_SYSTEM_PATH, listeners, node, artifact ); node.getArtifact().setFile( artifact.getFile() ); } }
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 ) { // TODO log message or throw exception? return null; } } }
Artifact farthestArtifact = farthest.getArtifact(); Artifact nearestArtifact = nearest.getArtifact(); if ( ( nearest.getDepth() < 2 ) && updateScope )
Artifact artifact = node.getArtifact(); node.getRemoteRepositories(), result ) );
public void addDependencies( Set<Artifact> artifacts, List<ArtifactRepository> remoteRepositories, ArtifactFilter filter ) throws CyclicDependencyException, OverConstrainedVersionException { if ( artifacts != null && !artifacts.isEmpty() ) { children = new ArrayList<>( artifacts.size() ); for ( Artifact a : artifacts ) { if ( parents.contains( a.getDependencyConflictId() ) ) { a.setDependencyTrail( getDependencyTrail() ); throw new CyclicDependencyException( "A dependency has introduced a cycle", a ); } children.add( new ResolutionNode( a, remoteRepositories, this ) ); } children = Collections.unmodifiableList( children ); } else { children = Collections.emptyList(); } trail = null; }
public void enable() { active = true; // TODO if it was null, we really need to go find them now... or is this taken care of by the ordering? if ( children != null ) { for ( ResolutionNode node : children ) { node.enable(); } } }
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 ) { // TODO log message or throw exception? return null; } } }
while ( node != null ) Artifact artifact = node.getArtifact(); if ( artifact.getVersion() == null )
listener.testArtifact( node.getArtifact() ); break; case ResolutionListener.PROCESS_CHILDREN: listener.startProcessChildren( node.getArtifact() ); break; case ResolutionListener.FINISH_PROCESSING_CHILDREN: listener.endProcessChildren( node.getArtifact() ); break; case ResolutionListener.INCLUDE_ARTIFACT: listener.includeArtifact( node.getArtifact() ); break; case ResolutionListener.OMIT_FOR_NEARER: listener.omitForNearer( node.getArtifact(), replacement ); break; case ResolutionListener.OMIT_FOR_CYCLE: listener.omitForCycle( node.getArtifact() ); break; case ResolutionListener.UPDATE_SCOPE: listener.updateScope( node.getArtifact(), replacement.getScope() ); break; case ResolutionListener.UPDATE_SCOPE_CURRENT_POM: listener.updateScopeCurrentPom( node.getArtifact(), replacement.getScope() ); break; case ResolutionListener.MANAGE_ARTIFACT_VERSION: asImpl.manageArtifactVersion( node.getArtifact(), replacement ); listener.manageArtifact( node.getArtifact(), replacement );