/** * Creates a new exception with the specified paths to conflicting nodes in the dependency graph. * * @param paths The paths to the dependency nodes that participate in the version conflict, may be {@code null}. */ public UnsolvableVersionConflictException( Collection<? extends List<? extends DependencyNode>> paths ) { super( "Could not resolve version conflict among " + toPaths( paths ) ); if ( paths == null ) { this.paths = Collections.emptyList(); this.versions = Collections.emptyList(); } else { this.paths = paths; this.versions = new LinkedHashSet<String>(); for ( List<? extends DependencyNode> path : paths ) { VersionConstraint constraint = path.get( path.size() - 1 ).getVersionConstraint(); if ( constraint != null && constraint.getRange() != null ) { versions.add( constraint.toString() ); } } } }
/** * Creates a new exception with the specified paths to conflicting nodes in the dependency graph. * * @param paths The paths to the dependency nodes that participate in the version conflict, may be {@code null}. */ public UnsolvableVersionConflictException( Collection<? extends List<? extends DependencyNode>> paths ) { super( "Could not resolve version conflict among " + toPaths( paths ) ); if ( paths == null ) { this.paths = Collections.emptyList(); this.versions = Collections.emptyList(); } else { this.paths = paths; this.versions = new LinkedHashSet<String>(); for ( List<? extends DependencyNode> path : paths ) { VersionConstraint constraint = path.get( path.size() - 1 ).getVersionConstraint(); if ( constraint != null && constraint.getRange() != null ) { versions.add( constraint.toString() ); } } } }
private static String toPath( List<? extends DependencyNode> path ) { StringBuilder buffer = new StringBuilder( 256 ); for ( Iterator<? extends DependencyNode> it = path.iterator(); it.hasNext(); ) { DependencyNode node = it.next(); if ( node.getDependency() == null ) { continue; } Artifact artifact = node.getDependency().getArtifact(); buffer.append( artifact.getGroupId() ); buffer.append( ':' ).append( artifact.getArtifactId() ); buffer.append( ':' ).append( artifact.getExtension() ); if ( artifact.getClassifier().length() > 0 ) { buffer.append( ':' ).append( artifact.getClassifier() ); } buffer.append( ':' ).append( node.getVersionConstraint() ); if ( it.hasNext() ) { buffer.append( " -> " ); } } return buffer.toString(); }
private static String toPath( List<? extends DependencyNode> path ) { StringBuilder buffer = new StringBuilder( 256 ); for ( Iterator<? extends DependencyNode> it = path.iterator(); it.hasNext(); ) { DependencyNode node = it.next(); if ( node.getDependency() == null ) { continue; } Artifact artifact = node.getDependency().getArtifact(); buffer.append( artifact.getGroupId() ); buffer.append( ':' ).append( artifact.getArtifactId() ); buffer.append( ':' ).append( artifact.getExtension() ); if ( artifact.getClassifier().length() > 0 ) { buffer.append( ':' ).append( artifact.getClassifier() ); } buffer.append( ':' ).append( node.getVersionConstraint() ); if ( it.hasNext() ) { buffer.append( " -> " ); } } return buffer.toString(); }
VersionConstraint versionConstraint = node.getVersionConstraint(); if (versionConstraint != null && versionConstraint.getRange() != null && isNotEmpty(versionConstraint.getRange())) { group.constraints.add(versionConstraint);
private DependencyNode buildDependencyNode( DependencyNode parent, org.eclipse.aether.graph.DependencyNode node, Artifact artifact, ArtifactFilter filter ) { String premanagedVersion = null; // DependencyManagerUtils.getPremanagedVersion( node ); String premanagedScope = null; // DependencyManagerUtils.getPremanagedScope( node ); DefaultDependencyNode current = new DefaultDependencyNode( parent, artifact, premanagedVersion, premanagedScope, getVersionSelectedFromRange( node.getVersionConstraint() ) ); List<DependencyNode> nodes = new ArrayList<DependencyNode>( node.getChildren().size() ); for ( org.eclipse.aether.graph.DependencyNode child : node.getChildren() ) { Artifact childArtifact = getDependencyArtifact( child.getDependency() ); if ( ( filter == null ) || filter.include( childArtifact ) ) { nodes.add( buildDependencyNode( current, child, childArtifact, filter ) ); } } current.setChildren( Collections.unmodifiableList( nodes ) ); return current; }
private DependencyNode buildDependencyNode( DependencyNode parent, org.eclipse.aether.graph.DependencyNode node, Artifact artifact, ArtifactFilter filter ) { String premanagedVersion = null; // DependencyManagerUtils.getPremanagedVersion( node ); String premanagedScope = null; // DependencyManagerUtils.getPremanagedScope( node ); Boolean optional = null; if ( node.getDependency() != null ) { optional = node.getDependency().isOptional(); } DefaultDependencyNode current = new DefaultDependencyNode( parent, artifact, premanagedVersion, premanagedScope, getVersionSelectedFromRange( node.getVersionConstraint() ), optional ); List<DependencyNode> nodes = new ArrayList<DependencyNode>( node.getChildren().size() ); for ( org.eclipse.aether.graph.DependencyNode child : node.getChildren() ) { Artifact childArtifact = getDependencyArtifact( child.getDependency() ); if ( ( filter == null ) || filter.include( childArtifact ) ) { nodes.add( buildDependencyNode( current, child, childArtifact, filter ) ); } } current.setChildren( Collections.unmodifiableList( nodes ) ); return current; }
/** * Creates a mostly shallow clone of the specified node. The new node has its own copy of any custom data and * initially no children. * * @param node The node to copy, must not be {@code null}. */ public DefaultDependencyNode( DependencyNode node ) { dependency = node.getDependency(); artifact = node.getArtifact(); children = new ArrayList<DependencyNode>( 0 ); setAliases( node.getAliases() ); setRequestContext( node.getRequestContext() ); setManagedBits( node.getManagedBits() ); setRelocations( node.getRelocations() ); setRepositories( node.getRepositories() ); setVersion( node.getVersion() ); setVersionConstraint( node.getVersionConstraint() ); Map<?, ?> data = node.getData(); setData( data.isEmpty() ? null : new HashMap<Object, Object>( data ) ); }
/** * Creates a mostly shallow clone of the specified node. The new node has its own copy of any custom data and * initially no children. * * @param node The node to copy, must not be {@code null}. */ public DefaultDependencyNode( DependencyNode node ) { dependency = node.getDependency(); artifact = node.getArtifact(); children = new ArrayList<DependencyNode>( 0 ); setAliases( node.getAliases() ); setRequestContext( node.getRequestContext() ); setManagedBits( node.getManagedBits() ); setRelocations( node.getRelocations() ); setRepositories( node.getRepositories() ); setVersion( node.getVersion() ); setVersionConstraint( node.getVersionConstraint() ); Map<?, ?> data = node.getData(); setData( data.isEmpty() ? null : new HashMap<Object, Object>( data ) ); }
VersionConstraint constraint = node.getVersionConstraint();
VersionConstraint constraint = node.getVersionConstraint();