protected Set<Artifact> filterDependencies(Set<Artifact> dependencies, FilterArtifacts filters) throws MojoExecutionException { try { Set<Artifact> filtered = new LinkedHashSet<>(dependencies); filtered.retainAll(filters.filter(dependencies)); return filtered; } catch (ArtifactFilterException ex) { throw new MojoExecutionException(ex.getMessage(), ex); } }
/** * Filter the marked dependencies * * @param artifacts The artifacts set {@link Artifact}. * @return status set {@link DependencyStatusSets}. * @throws MojoExecutionException in case of an error. */ protected DependencyStatusSets filterMarkedDependencies( Set<Artifact> artifacts ) throws MojoExecutionException { // remove files that have markers already FilterArtifacts filter = new FilterArtifacts(); filter.clearFilters(); filter.addFilter( getMarkedArtifactFilter() ); Set<Artifact> unMarkedArtifacts; try { unMarkedArtifacts = filter.filter( artifacts ); } catch ( ArtifactFilterException e ) { throw new MojoExecutionException( e.getMessage(), e ); } // calculate the skipped artifacts Set<Artifact> skippedArtifacts = new LinkedHashSet<Artifact>(); skippedArtifacts.addAll( artifacts ); skippedArtifacts.removeAll( unMarkedArtifacts ); return new DependencyStatusSets( unMarkedArtifacts, null, skippedArtifacts ); }
throw new MojoExecutionException( e.getMessage(), e );
artifacts = filter.filter(artifacts); } catch (ArtifactFilterException e) { throw new MojoExecutionException(e.getMessage(), e);
@SuppressWarnings("unchecked") public void execute() throws MojoExecutionException, MojoFailureException { FilterArtifacts filter = new FilterArtifacts(); filter.addFilter(new ScopeFilter(Artifact.SCOPE_TEST, null)); filter.addFilter(new TypeFilter("jar", null)); Set<Artifact> artifacts; try { artifacts = filter.filter(projectArtifacts); } catch (ArtifactFilterException ex) { throw new MojoExecutionException(ex.getMessage(), ex); } // create output directory with link files outputDirectory.mkdirs(); for (Artifact artifact : artifacts) { Manifest manifest = getManifest(artifact); if (manifest != null) { createLinkFile(artifact, manifest); } } // add output directory as test resource directory Resource resource = new Resource(); resource.setDirectory(outputDirectory.toString()); build.addTestResource(resource); }
throw new MojoExecutionException( e.getMessage(), e );
artifacts = filter.filter(artifacts); } catch (ArtifactFilterException ex) { throw new MojoExecutionException(ex.getMessage(), ex); throw new MojoExecutionException(ex.getMessage(), ex); } catch (IOException ex) { throw new MojoExecutionException(ex.getMessage(), ex);
throw new MojoExecutionException( e.getMessage(), e );