List of usage examples for org.apache.maven.artifact.resolver.filter IncludesArtifactFilter IncludesArtifactFilter
public IncludesArtifactFilter(List<String> patterns)
From source file:br.com.anteros.restdoc.maven.plugin.AnterosRestDocMojo.java
License:Apache License
/** * Returns a ArtifactFilter that only includes direct dependencies of this * project (verified via groupId and artifactId). * * @return/*from w ww . j a v a 2s . c o m*/ */ private ArtifactFilter createDependencyArtifactFilter() { Set<Artifact> dependencyArtifacts = project.getDependencyArtifacts(); List<String> artifactPatterns = new ArrayList<String>(dependencyArtifacts.size()); for (Artifact artifact : dependencyArtifacts) { artifactPatterns.add(artifact.getGroupId() + ":" + artifact.getArtifactId()); } return new IncludesArtifactFilter(artifactPatterns); }
From source file:com.googlecode.mycontainer.maven.plugin.ExecMojo.java
License:Apache License
private List filterArtifacts(List artifacts, Collection dependencies) { AndArtifactFilter filter = new AndArtifactFilter(); filter.add(new IncludesArtifactFilter(new ArrayList(dependencies))); // gosh List filteredArtifacts = new ArrayList(); for (Iterator it = artifacts.iterator(); it.hasNext();) { Artifact artifact = (Artifact) it.next(); if (filter.include(artifact)) { getLog().debug("filtering in " + artifact); filteredArtifacts.add(artifact); }/* w w w .j a va 2 s .c om*/ } return filteredArtifacts; }
From source file:kr.motd.maven.exec.ExecMojo.java
License:Apache License
private List<Artifact> filterArtifacts(List<Artifact> artifacts, Collection<String> dependencies) { AndArtifactFilter filter = new AndArtifactFilter(); filter.add(new IncludesArtifactFilter(new ArrayList<String>(dependencies))); // gosh List<Artifact> filteredArtifacts = new ArrayList<Artifact>(); for (Artifact artifact : artifacts) { if (filter.include(artifact)) { getLog().debug("filtering in " + artifact); filteredArtifacts.add(artifact); }//from w w w .ja va 2s .c om } return filteredArtifacts; }
From source file:net.hasor.maven.ExecMojo.java
License:Apache License
private List<Artifact> filterArtifacts(List<Artifact> artifacts, Collection<String> dependencies) { AndArtifactFilter filter = new AndArtifactFilter(); filter.add(new IncludesArtifactFilter(new ArrayList<String>(dependencies))); // gosh List<Artifact> filteredArtifacts = new ArrayList<Artifact>(); for (Artifact artifact : artifacts) { if (filter.include(artifact)) { getLog().debug("filtering in " + artifact); filteredArtifacts.add(artifact); }/*ww w . j av a2 s . c om*/ } return filteredArtifacts; }
From source file:org.codehaus.mojo.webstart.AbstractJnlpMojo.java
License:Apache License
/** * @param pattern pattern to test over artifacts * @param artifacts collection of artifacts to check * @return true if filter matches no artifact, false otherwise * *///from w w w. j av a 2s. c o m private boolean ensurePatternMatchesAtLeastOneArtifact(String pattern, Collection<Artifact> artifacts) { List<String> onePatternList = new ArrayList<String>(); onePatternList.add(pattern); ArtifactFilter filter = new IncludesArtifactFilter(onePatternList); boolean noMatch = true; for (Artifact artifact : artifacts) { getLog().debug("checking pattern: " + pattern + " against " + artifact); if (filter.include(artifact)) { noMatch = false; break; } } if (noMatch) { getLog().error("pattern: " + pattern + " doesn't match any artifact."); } return noMatch; }
From source file:org.codehaus.mojo.webstart.AbstractJnlpMojo.java
License:Apache License
/** * Iterate through all the top level and transitive dependencies declared in the project and * collect all the runtime scope dependencies for inclusion in the .zip and signing. * * @throws MojoExecutionException if could not process dependencies *//*from w w w . j a v a2s . c om*/ private void processDependencies() throws MojoExecutionException { processDependency(getProject().getArtifact()); AndArtifactFilter filter = new AndArtifactFilter(); // filter.add( new ScopeArtifactFilter( dependencySet.getScope() ) ); if (dependencies != null && dependencies.getIncludes() != null && !dependencies.getIncludes().isEmpty()) { filter.add(new IncludesArtifactFilter(dependencies.getIncludes())); } if (dependencies != null && dependencies.getExcludes() != null && !dependencies.getExcludes().isEmpty()) { filter.add(new ExcludesArtifactFilter(dependencies.getExcludes())); } Collection<Artifact> artifacts = isExcludeTransitive() ? getProject().getDependencyArtifacts() : getProject().getArtifacts(); for (Artifact artifact : artifacts) { if (filter.include(artifact)) { processDependency(artifact); } } }
From source file:org.codehaus.mojo.webstart.AbstractJnlpMojo.java
License:Apache License
/** * Iterate through all the extensions dependencies declared in the project and * collect all the runtime scope dependencies for inclusion in the .zip and just * copy them to the lib directory.//from w w w.j av a 2s . co m * <p/> * TODO, should check that all dependencies are well signed with the same * extension with the same signer. * * @throws MojoExecutionException */ private void processExtensionsDependencies() throws MojoExecutionException { Collection<Artifact> artifacts = isExcludeTransitive() ? getProject().getDependencyArtifacts() : getProject().getArtifacts(); for (JnlpExtension extension : jnlpExtensions) { ArtifactFilter filter = new IncludesArtifactFilter(extension.getIncludes()); for (Artifact artifact : artifacts) { if (filter.include(artifact)) { processExtensionDependency(extension, artifact); } } } }