collectRequest.setRoot(new Dependency(artifact, JavaScopes.COMPILE));
@Override public boolean accept(final DependencyNode node, final List<DependencyNode> parents) { return !node.getDependency().isOptional(); } }
/** * Creates a dependency on the specified artifact with the given scope and exclusions. * * @param artifact The artifact being depended on, must not be {@code null}. * @param scope The scope of the dependency, may be {@code null}. * @param optional A flag whether the dependency is optional or mandatory. * @param exclusions The exclusions that apply to transitive dependencies, may be {@code null} if none. */ public Dependency( Artifact artifact, String scope, boolean optional, Collection<Exclusion> exclusions ) { this( artifact, scope, Exclusions.copy( exclusions ), optional ); }
public boolean accept( DependencyNode node, List<DependencyNode> parents ) { Dependency dependency = node.getDependency(); if ( dependency == null ) { return true; } String scope = node.getDependency().getScope(); return ( included.isEmpty() || included.contains( scope ) ) && ( excluded.isEmpty() || !excluded.contains( scope ) ); }
/** * Sets the exclusions for the dependency. * * @param exclusions The exclusions, may be {@code null}. * @return The new dependency, never {@code null}. */ public Dependency setExclusions( Collection<Exclusion> exclusions ) { if ( hasEquivalentExclusions( exclusions ) ) { return this; } return new Dependency( artifact, scope, optional, exclusions ); }
public void setArtifact( Artifact artifact ) { this.dependency = dependency.setArtifact( artifact ); }
public boolean accept( DependencyNode node, List<DependencyNode> parents ) { for ( DependencyFilter filter : filters ) { if ( !filter.accept( node, parents ) ) { return false; } } return true; }
public void setScope( String scope ) { this.dependency = dependency.setScope( scope ); }
private List<ArtifactResult> fetchArtifactWithDep(Dependency dep) throws DependencyResolutionException, ArtifactResolutionException { Artifact artifact = new DefaultArtifact(dep.getGroupArtifactVersion()); DependencyFilter classpathFilter = DependencyFilterUtils .classpathFilter(JavaScopes.COMPILE); PatternExclusionsDependencyFilter exclusionFilter = new PatternExclusionsDependencyFilter( dep.getExclusions()); CollectRequest collectRequest = new CollectRequest(); collectRequest.setRoot(new org.sonatype.aether.graph.Dependency(artifact, JavaScopes.COMPILE)); collectRequest.addRepository(mavenCentral); collectRequest.addRepository(mavenLocal); for (Repository repo : repositories) { RemoteRepository rr = new RemoteRepository(repo.getId(), "default", repo.getUrl()); rr.setPolicy(repo.isSnapshot(), null); collectRequest.addRepository(rr); } DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.andFilter(exclusionFilter, classpathFilter)); return system.resolveDependencies(session, dependencyRequest).getArtifactResults(); }
public void setArtifact( Artifact artifact ) { dependency = dependency.setArtifact( artifact ); }
public boolean accept( DependencyNode node, List<DependencyNode> parents ) { for ( DependencyFilter filter : filters ) { if ( filter.accept( node, parents ) ) { return true; } } return false; }
public void setScope( String scope ) { dependency = dependency.setScope( scope ); }
/** * Creates a dependency on the specified artifact with the given scope and exclusions. * * @param artifact The artifact being depended on, must not be {@code null}. * @param scope The scope of the dependency, may be {@code null}. * @param optional A flag whether the dependency is optional or mandatory. * @param exclusions The exclusions that apply to transitive dependencies, may be {@code null} if none. */ public Dependency( Artifact artifact, String scope, boolean optional, Collection<Exclusion> exclusions ) { this( artifact, scope, Exclusions.copy( exclusions ), optional ); }
private static Dependency createDependency(final Artifact artifact) { final Dependency dependency = new Dependency(artifact, "runtime"); return dependency; }
public void setArtifact( Artifact artifact ) { dependency = dependency.setArtifact( artifact ); }
public boolean accept( DependencyNode node, List<DependencyNode> parents ) { return !filter.accept( node, parents ); }
public void setScope( String scope ) { dependency = dependency.setScope( scope ); }
/** * Creates a dependency on the specified artifact with the given scope and exclusions. * * @param artifact The artifact being depended on, must not be {@code null}. * @param scope The scope of the dependency, may be {@code null}. * @param optional A flag whether the dependency is optional or mandatory. * @param exclusions The exclusions that apply to transitive dependencies, may be {@code null} if none. */ public Dependency( Artifact artifact, String scope, boolean optional, Collection<Exclusion> exclusions ) { this( artifact, scope, Exclusions.copy( exclusions ), optional ); }
/** * Sets the optional flag for the dependency. * * @param optional {@code true} if the dependency is optional, {@code false} if the dependency is mandatory. * @return The new dependency, never {@code null}. */ public Dependency setOptional( boolean optional ) { if ( this.optional == optional ) { return this; } return new Dependency( artifact, scope, exclusions, optional ); }
public void setArtifact( Artifact artifact ) { this.dependency = dependency.setArtifact( artifact ); }