當前位置: 首頁>>代碼示例>>Java>>正文


Java OrArtifactFilter類代碼示例

本文整理匯總了Java中org.apache.maven.artifact.resolver.filter.OrArtifactFilter的典型用法代碼示例。如果您正苦於以下問題:Java OrArtifactFilter類的具體用法?Java OrArtifactFilter怎麽用?Java OrArtifactFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OrArtifactFilter類屬於org.apache.maven.artifact.resolver.filter包,在下文中一共展示了OrArtifactFilter類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createTransitiveDependencyFilter

import org.apache.maven.artifact.resolver.filter.OrArtifactFilter; //導入依賴的package包/類
private ArtifactFilter createTransitiveDependencyFilter(MavenProject project) {
  List<String> dependencyKeys = new ArrayList<>(project.getDependencies().size());
  for (Dependency dependency : project.getDependencies()) {
    dependencyKeys.add(dependency.getManagementKey());
  }

  // Matches direct dependencies or the configured transitive dependencies or the project itself
  OrArtifactFilter artifactFilter = new OrArtifactFilter();
  artifactFilter.add(this.transitiveIncludeExcludeFilter);
  artifactFilter.add(new StrictPatternIncludesArtifactFilter(dependencyKeys));
  artifactFilter.add(new StrictPatternIncludesArtifactFilter(singletonList(project.getArtifact().toString())));

  return artifactFilter;
}
 
開發者ID:ferstl,項目名稱:depgraph-maven-plugin,代碼行數:15,代碼來源:MavenGraphAdapter.java

示例2: processTransitiveDependencies

import org.apache.maven.artifact.resolver.filter.OrArtifactFilter; //導入依賴的package包/類
private Set<Artifact> processTransitiveDependencies( Dependency dependency, boolean sharedLibraries )
        throws MojoExecutionException
{
    log.debug( "Processing transitive dependencies for : " + dependency );

    try
    {
        final Set<Artifact> artifacts = new LinkedHashSet<Artifact>();

        final List<String> exclusionPatterns = new ArrayList<String>();
        if ( dependency.getExclusions() != null && !dependency.getExclusions().isEmpty() )
        {
            for ( final Exclusion exclusion : dependency.getExclusions() )
            {
                exclusionPatterns.add( exclusion.getGroupId() + ":" + exclusion.getArtifactId() );
            }
        }
        final ArtifactFilter optionalFilter = new ArtifactFilter()
        {
            @Override
            public boolean include( Artifact artifact )
            {
                return !artifact.isOptional();
            }
        };

        final AndArtifactFilter filter = new AndArtifactFilter();
        filter.add( new ExcludesArtifactFilter( exclusionPatterns ) );
        filter.add( new OrArtifactFilter( Arrays.<ArtifactFilter>asList( new ScopeArtifactFilter( "compile" ),
                new ScopeArtifactFilter( "runtime" ),
                new ScopeArtifactFilter( "test" ) ) ) );
        filter.add( optionalFilter );

        final DependencyNode node = dependencyGraphBuilder.buildDependencyGraph( project, filter );
        final CollectingDependencyNodeVisitor collectingVisitor = new CollectingDependencyNodeVisitor();
        node.accept( collectingVisitor );

        final List<DependencyNode> dependencies = collectingVisitor.getNodes();
        for ( final DependencyNode dep : dependencies )
        {
            final boolean isNativeLibrary = isNativeLibrary( sharedLibraries, dep.getArtifact().getType() );
            log.debug( "Processing library : " + dep.getArtifact() + " isNative=" + isNativeLibrary );
            if ( isNativeLibrary )
            {
                artifacts.add( dep.getArtifact() );
            }
        }

        return artifacts;
    }
    catch ( Exception e )
    {
        throw new MojoExecutionException( "Error while processing transitive dependencies", e );
    }
}
 
開發者ID:simpligility,項目名稱:android-ndk-maven-plugin,代碼行數:56,代碼來源:NativeHelper.java


注:本文中的org.apache.maven.artifact.resolver.filter.OrArtifactFilter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。