当前位置: 首页>>代码示例>>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;未经允许,请勿转载。