本文整理匯總了Java中org.apache.maven.artifact.resolver.filter.ArtifactFilter.include方法的典型用法代碼示例。如果您正苦於以下問題:Java ArtifactFilter.include方法的具體用法?Java ArtifactFilter.include怎麽用?Java ArtifactFilter.include使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.artifact.resolver.filter.ArtifactFilter
的用法示例。
在下文中一共展示了ArtifactFilter.include方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isIncluded
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
/**
* Determine if the artifact is included in the list of artifacts to be processed.
*
* @param artifact The artifact we want to check.
* @return true if the artifact should be processed, false otherwise.
*/
protected boolean isIncluded( Artifact artifact )
{
boolean result = true;
ArtifactFilter includesFilter = this.getIncludesArtifactFilter();
if ( includesFilter != null )
{
result = includesFilter.include( artifact );
}
ArtifactFilter excludesFilter = this.getExcludesArtifactFilter();
if ( excludesFilter != null )
{
result = result && excludesFilter.include( artifact );
}
return result;
}
示例2: ensurePatternMatchesAtLeastOneArtifact
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
/**
* @param pattern pattern to test over artifacts
* @param artifacts collection of artifacts to check
* @return true if filter matches no artifact, false otherwise *
*/
private boolean ensurePatternMatchesAtLeastOneArtifact( String pattern, Collection<Artifact> artifacts )
{
List<String> onePatternList = new ArrayList<>();
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;
}
示例3: processExtensionsDependencies
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
/**
* 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.
* <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 );
}
}
}
}
示例4: isIncluded
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
/**
* Determine if the artifact is included in the list of artifacts to be processed.
*
* @param artifact The artifact we want to check.
* @return true if the artifact should be processed, false otherwise.
*/
protected boolean isIncluded( Artifact artifact )
{
boolean result = true;
ArtifactFilter includesFilter = this.getIncludesArtifactFilter();
if ( includesFilter != null )
{
result = includesFilter.include( artifact );
}
ArtifactFilter excludesFilter = this.getExcludesArtifactFilter();
if ( excludesFilter != null )
{
result = result && excludesFilter.include( artifact );
}
return result;
}
開發者ID:petr-ujezdsky,項目名稱:versions-maven-plugin-svn-clone,代碼行數:28,代碼來源:AbstractVersionsDependencyUpdaterMojo.java
示例5: filterTrail
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
public boolean filterTrail( ArtifactFilter filter )
throws OverConstrainedVersionException
{
boolean success = true;
if ( filter != null )
{
for ( Artifact artifact : getTrail() )
{
if ( !filter.include( artifact ) )
{
success = false;
}
}
}
return success;
}
示例6: analyzeDependencies
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
private void analyzeDependencies() throws MojoExecutionException {
Set<Artifact> dependencies = this.project.getDependencyArtifacts();
ArtifactFilter filter = createArtifactFilter();
for (Artifact dependency : dependencies) {
if (filter.include(dependency)) {
getLog().debug("Analyzing " + dependency);
scanAndprintReport(dependency.toString(), dependency.getFile());
}
}
}
示例7: createDependencyArtifact
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
private static Artifact createDependencyArtifact( ArtifactFactory factory, Dependency dependency,
String inheritedScope, ArtifactFilter inheritedFilter )
throws InvalidVersionSpecificationException
{
String effectiveScope = getEffectiveScope( dependency.getScope(), inheritedScope );
if ( effectiveScope == null )
{
return null;
}
VersionRange versionRange = VersionRange.createFromVersionSpec( dependency.getVersion() );
Artifact dependencyArtifact =
factory.createDependencyArtifact( dependency.getGroupId(), dependency.getArtifactId(), versionRange,
dependency.getType(), dependency.getClassifier(), effectiveScope,
dependency.isOptional() );
ArtifactFilter dependencyFilter = inheritedFilter;
if ( dependencyFilter != null && !dependencyFilter.include( dependencyArtifact ) )
{
return null;
}
if ( Artifact.SCOPE_SYSTEM.equals( effectiveScope ) )
{
dependencyArtifact.setFile( new File( dependency.getSystemPath() ) );
}
dependencyArtifact.setDependencyFilter( createDependencyFilter( dependency, dependencyFilter ) );
return dependencyArtifact;
}
示例8: createArtifacts
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
private Set createArtifacts( ArtifactFactory artifactFactory, Set dependencies, String inheritedScope,
ArtifactFilter dependencyFilter )
throws InvalidVersionSpecificationException
{
Set projectArtifacts = new HashSet();
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
{
Artifact d = (Artifact) i.next();
VersionRange versionRange;
if ( d.getVersionRange() != null )
{
versionRange = d.getVersionRange();
}
else
{
versionRange = VersionRange.createFromVersionSpec( d.getVersion() );
}
Artifact artifact;
if ( d.getScope().equals( Artifact.SCOPE_TEST ) || d.getScope().equals( Artifact.SCOPE_PROVIDED ) )
{
/* don't call createDependencyArtifact as it'll ignore test and provided scopes */
artifact =
artifactFactory.createArtifact( d.getGroupId(), d.getArtifactId(), d.getVersion(),
d.getScope(), d.getType() );
}
else
{
artifact =
artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange,
d.getType(), d.getClassifier(), d.getScope(),
inheritedScope, d.isOptional() );
}
if ( artifact != null && ( dependencyFilter == null || dependencyFilter.include( artifact ) ) )
{
artifact.setDependencyFilter( dependencyFilter );
projectArtifacts.add( artifact );
}
}
return projectArtifacts;
}
示例9: copyLibs
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入方法依賴的package包/類
/**
* Copy direct (non-transitive) dependencies that are <strong>not bundles</strong> to the {@literal libs} directory
* of the Wisdom server. As using such kind of dependencies does not really embrace the modular way promoted by
* Wisdom, the copy is "explicit" meaning that the dependencies must be declared in the project that is going to
* be run.
* <p>
* Only direct dependencies from the scope {@code compile} are copied.
*
* @param mojo the mojo
* @param graph the dependency graph builder
* @return the list of artifact copied to the 'libs' directory. Empty is none.
* @throws IOException when a file cannot be copied
*/
public static Set<Artifact> copyLibs(AbstractWisdomMojo mojo, DependencyGraphBuilder graph, Libraries libraries)
throws IOException {
if (libraries == null || !libraries.hasLibraries()) {
return Collections.emptySet();
}
File libsDirectory = new File(mojo.getWisdomRootDirectory(), "libs");
ArtifactFilter filter = libraries.getFilter();
Set<Artifact> artifacts = getArtifactsToConsider(mojo, graph, true, null);
for (final Iterator<Artifact> it = artifacts.iterator(); it.hasNext(); ) {
final Artifact artifact = it.next();
if (!filter.include(artifact)) {
it.remove();
if (mojo.getLog().isDebugEnabled()) {
mojo.getLog().debug(artifact.getId() + " was removed by filters.");
}
continue;
}
if (BundleExclusions.isExcluded(artifact)) {
it.remove();
mojo.getLog().info("Dependency " + artifact + " not copied - the artifact is on the exclusion list");
continue;
}
// We still have to do this test, as when using the direct dependencies we may include test and provided
// dependencies.
if (SCOPE_COMPILE.equalsIgnoreCase(artifact.getScope())) {
File file = artifact.getFile();
if (file != null && file.isFile()) {
mojo.getLog().warn("Copying " + file.getName() + " to the libs directory");
FileUtils.copyFileToDirectory(file, libsDirectory);
} else {
mojo.getLog().warn("Cannot copy the file associated with " + artifact.getArtifactId() + " - the " +
"file is missing");
}
} else {
it.remove();
}
}
return artifacts;
}