@Override public MavenWorkingSession execute(MavenWorkingSession session) { // Get all declared dependencies final List<MavenDependency> dependencies = new ArrayList<MavenDependency>(session.getDeclaredDependencies()); // For all declared dependencies, add 'em to the Set of dependencies to be resolved for // this request for (final MavenDependency candidate : dependencies) { session.getDependenciesForResolution().add(candidate); } return session; }
@Override public MavenWorkingSession execute(MavenWorkingSession session) { // Get all declared dependencies final List<MavenDependency> dependencies = new ArrayList<MavenDependency>(session.getDeclaredDependencies()); // For all declared dependencies, add 'em to the Set of dependencies to be resolved for // this request for (final MavenDependency candidate : dependencies) { session.getDependenciesForResolution().add(candidate); } return session; }
private RESOLVESTAGETYPE addDependencies(final String... coordinates) throws CoordinateParseException, IllegalArgumentException { if (coordinates == null || coordinates.length == 0) { throw new IllegalArgumentException("At least one coordinate must be specified"); } for (final String coordinate : coordinates) { if (coordinate == null || coordinate.length() == 0) { throw new IllegalArgumentException("null dependency not permitted"); } final MavenDependency dependency = this.resolveDependency(coordinate); this.session.getDependenciesForResolution().add(dependency); } return this.covarientReturn(); }
private RESOLVESTAGETYPE addDependencies(final String... coordinates) throws CoordinateParseException, IllegalArgumentException { if (coordinates == null || coordinates.length == 0) { throw new IllegalArgumentException("At least one coordinate must be specified"); } for (final String coordinate : coordinates) { if (coordinate == null || coordinate.length() == 0) { throw new IllegalArgumentException("null dependency not permitted"); } final MavenDependency dependency = this.resolveDependency(coordinate); this.session.getDependenciesForResolution().add(dependency); } return this.covarientReturn(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.resolver.api.ResolveStage#addDependency(org.jboss.shrinkwrap.resolver.api.Coordinate) */ @Override public final RESOLVESTAGETYPE addDependency(final MavenDependency dependency) throws IllegalArgumentException { if (dependency == null) { throw new IllegalArgumentException("dependency must be specified"); } final MavenDependency resolved = this.resolveDependency(dependency); this.session.getDependenciesForResolution().add(resolved); return this.covarientReturn(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.resolver.api.ResolveStage#addDependency(org.jboss.shrinkwrap.resolver.api.Coordinate) */ @Override public final RESOLVESTAGETYPE addDependency(final MavenDependency dependency) throws IllegalArgumentException { if (dependency == null) { throw new IllegalArgumentException("dependency must be specified"); } final MavenDependency resolved = this.resolveDependency(dependency); this.session.getDependenciesForResolution().add(resolved); return this.covarientReturn(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.resolver.api.ResolveStage#addDependencies(Coordinate[]) */ @Override public final RESOLVESTAGETYPE addDependencies(final MavenDependency... dependencies) throws IllegalArgumentException { if (dependencies == null || dependencies.length == 0) { throw new IllegalArgumentException("At least one coordinate must be specified"); } for (final MavenDependency dependency : dependencies) { if (dependency == null) { throw new IllegalArgumentException("null dependency not permitted"); } final MavenDependency resolved = this.resolveDependency(dependency); this.session.getDependenciesForResolution().add(resolved); } return this.covarientReturn(); }
/** * {@inheritDoc} * * @see org.jboss.shrinkwrap.resolver.api.ResolveStage#addDependencies(Coordinate[]) */ @Override public final RESOLVESTAGETYPE addDependencies(final MavenDependency... dependencies) throws IllegalArgumentException { if (dependencies == null || dependencies.length == 0) { throw new IllegalArgumentException("At least one coordinate must be specified"); } for (final MavenDependency dependency : dependencies) { if (dependency == null) { throw new IllegalArgumentException("null dependency not permitted"); } final MavenDependency resolved = this.resolveDependency(dependency); this.session.getDependenciesForResolution().add(resolved); } return this.covarientReturn(); }
@Override public MavenWorkingSession execute(MavenWorkingSession session) { // Get all declared dependencies final List<MavenDependency> dependencies = new ArrayList<MavenDependency>(session.getDeclaredDependencies()); // Filter by scope final MavenResolutionFilter preResolutionFilter = new ScopeFilter(scopes); // For all declared dependencies which pass the filter, add 'em to the Set of dependencies to be resolved for // this request for (final MavenDependency candidate : dependencies) { if (preResolutionFilter.accepts(candidate, EMPTY_LIST, EMPTY_LIST)) { session.getDependenciesForResolution().add(candidate); } } return session; }
@Override public MavenWorkingSession execute(MavenWorkingSession session) { // Get all declared dependencies final List<MavenDependency> dependencies = new ArrayList<MavenDependency>(session.getDeclaredDependencies()); // Filter by scope final MavenResolutionFilter preResolutionFilter = new ScopeFilter(scopes); // For all declared dependencies which pass the filter, add 'em to the Set of dependencies to be resolved for // this request for (final MavenDependency candidate : dependencies) { if (preResolutionFilter.accepts(candidate, EMPTY_LIST, EMPTY_LIST)) { session.getDependenciesForResolution().add(candidate); } } return session; }
@Override public FORMATSTAGETYPE using(final MavenResolutionStrategy strategy) throws IllegalArgumentException { // first, get dependencies specified for resolution in the session Validate.notEmpty(session.getDependenciesForResolution(), "No dependencies were set for resolution"); final Collection<MavenResolvedArtifact> resolvedArtifacts = session.resolveDependencies(strategy); // Proceed to format stage return this.createFormatStage(resolvedArtifacts); }
@Override public FORMATSTAGETYPE using(final MavenResolutionStrategy strategy) throws IllegalArgumentException { // first, get dependencies specified for resolution in the session Validate.notEmpty(session.getDependenciesForResolution(), "No dependencies were set for resolution"); final Collection<MavenResolvedArtifact> resolvedArtifacts = session.resolveDependencies(strategy); // Proceed to format stage return this.createFormatStage(resolvedArtifacts); }
/** * Resolves artifact dependencies. * * The {@link ArtifactResult} contains a reference to a file in Maven local repository. * * @param repoSession The current Maven session * @param swrSession SWR Aether session abstraction * @param request The request to be computed * @param filters The filters of dependency results * @return A collection of artifacts which have built dependency tree from {@code request} * @throws DependencyResolutionException If a dependency could not be computed or collected */ public Collection<ArtifactResult> resolveDependencies(final RepositorySystemSession repoSession, final MavenWorkingSession swrSession, final CollectRequest request, final MavenResolutionFilter[] filters) throws DependencyResolutionException { final DependencyRequest depRequest = new DependencyRequest(request, new MavenResolutionFilterWrap(filters, Collections.unmodifiableList(new ArrayList<MavenDependency>(swrSession.getDependenciesForResolution())))); DependencyResult result = system.resolveDependencies(repoSession, depRequest); return result.getArtifactResults(); }
/** * Resolves artifact dependencies. * * The {@link ArtifactResult} contains a reference to a file in Maven local repository. * * @param repoSession The current Maven session * @param swrSession SWR Aether session abstraction * @param request The request to be computed * @param filters The filters of dependency results * @return A collection of artifacts which have built dependency tree from {@code request} * @throws DependencyResolutionException If a dependency could not be computed or collected */ public Collection<ArtifactResult> resolveDependencies(final RepositorySystemSession repoSession, final MavenWorkingSession swrSession, final CollectRequest request, final MavenResolutionFilter[] filters) throws DependencyResolutionException { final DependencyRequest depRequest = new DependencyRequest(request, new MavenResolutionFilterWrap(filters, Collections.unmodifiableList(new ArrayList<MavenDependency>(swrSession.getDependenciesForResolution())))); DependencyResult result = system.resolveDependencies(repoSession, depRequest); return result.getArtifactResults(); }
.importRuntimeAndTestDependencies()) .getMavenWorkingSession() .getDependenciesForResolution() .stream() .map(d -> gav(d.getGroupId(), d.getArtifactId(), d.getVersion()))