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


Java ArtifactFilter類代碼示例

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


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

示例1: createDependencyTree

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
private static DependencyNode createDependencyTree(MavenProject project,
        DependencyTreeBuilder dependencyTreeBuilder, ArtifactRepository localRepository,
        ArtifactFactory artifactFactory, ArtifactMetadataSource artifactMetadataSource,
        ArtifactCollector artifactCollector,
        String scope) {
    ArtifactFilter artifactFilter = createResolvingArtifactFilter(scope);

    try {
        // TODO: note that filter does not get applied due to MNG-3236
        return dependencyTreeBuilder.buildDependencyTree(project,
                localRepository, artifactFactory,
                artifactMetadataSource, artifactFilter, artifactCollector);
    } catch (DependencyTreeBuilderException exception) {
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:DependencyTreeFactory.java

示例2: createArtifactResolutionResult

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
private ArtifactResolutionResult createArtifactResolutionResult( Collection<Artifact> artifacts, List<Artifact> missingArtifacts, ArtifactResolutionException exception, ArtifactFilter filter ) {
   ArtifactResolutionResult result = new ArtifactResolutionResult();
   Set<Artifact> strippedArtifacts = new HashSet<Artifact>( artifacts );
   if( OptionalArtifactFilter.INSTANCE.equals( filter ) ){
      Iterator<Artifact> artifactItr = strippedArtifacts.iterator();
      while( artifactItr.hasNext() ){
         boolean include = OptionalArtifactFilter.INSTANCE.include( artifactItr.next() );
         if( !include ){
            artifactItr.remove();
         }
      }
   }
   result.setArtifacts( new HashSet<Artifact>( strippedArtifacts ) );
   if( missingArtifacts != null ){
      result.setUnresolvedArtifacts( missingArtifacts );
   }
   if( exception != null ){
      result.addErrorArtifactException( exception );
   }
   return result;
}
 
開發者ID:ZsZs,項目名稱:FitNesseLauncher,代碼行數:22,代碼來源:FitNesseMojoTestHelper.java

示例3: resolveTransitively

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact, Map managedVersions, ArtifactRepository localRepository,
                                                     List<ArtifactRepository> remoteRepositories, ArtifactMetadataSource source, ArtifactFilter filter, List<ResolutionListener> listeners,
                                                     List<ConflictResolver> conflictResolvers )
  throws ArtifactResolutionException, ArtifactNotFoundException
{
  ArtifactResolutionRequest request = new ArtifactResolutionRequest()
    .setArtifact( originatingArtifact )
    .setResolveRoot( false )
      // This is required by the surefire plugin
    .setArtifactDependencies( artifacts )
    .setManagedVersionMap( managedVersions )
    .setLocalRepository( localRepository )
    .setRemoteRepositories( remoteRepositories )
    .setCollectionFilter( filter )
    .setListeners( listeners );

  injectSession2( request, legacySupport.getSession() );

  return resolveWithExceptions( request );
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:CustomMaven3ArtifactResolver.java

示例4: resolveTransitively

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
public ArtifactResolutionResult resolveTransitively( Set<Artifact> artifacts, Artifact originatingArtifact,
                                                     Map managedVersions, ArtifactRepository localRepository,
                                                     List<ArtifactRepository> remoteRepositories,
                                                     ArtifactMetadataSource source, ArtifactFilter filter,
                                                     List<ResolutionListener> listeners,
                                                     List<ConflictResolver> conflictResolvers )
  throws ArtifactResolutionException, ArtifactNotFoundException
{
  ArtifactResolutionRequest request = new ArtifactResolutionRequest()
    .setArtifact( originatingArtifact )
    .setResolveRoot( false )
      // This is required by the surefire plugin
    .setArtifactDependencies( artifacts )
    .setManagedVersionMap( managedVersions )
    .setLocalRepository( localRepository )
    .setRemoteRepositories( remoteRepositories )
    .setCollectionFilter( filter )
    .setListeners( listeners );

  injectSession2( request, legacySupport.getSession() );

  return resolveWithExceptions( request );
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:CustomMaven32ArtifactResolver.java

示例5: getCompilerDependencies

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
private List<File> getCompilerDependencies( Artifact scalaCompilerArtifact, Artifact scalaLibraryArtifact )
    throws ArtifactNotFoundException, ArtifactResolutionException
{
    ArtifactFilter scalaLibraryFilter =
        new ExcludesArtifactFilter( Collections.singletonList( scalaLibraryArtifact.getGroupId() + ":"
            + scalaLibraryArtifact.getArtifactId() ) );
    List<File> d = new ArrayList<File>();
    for ( Artifact artifact : getAllDependencies( scalaCompilerArtifact, scalaLibraryFilter ) )
    {
        if ( !scalaCompilerArtifact.getGroupId().equals( artifact.getGroupId() )
            || !scalaCompilerArtifact.getArtifactId().equals( artifact.getArtifactId() ) )
        {
            d.add( artifact.getFile() ); // don't add scalaCompilerArtifact file
        }
    }
    return d;
}
 
開發者ID:sbt-compiler-maven-plugin,項目名稱:sbt-compiler-maven-plugin,代碼行數:18,代碼來源:AbstractSBTCompileMojo.java

示例6: createArtifactFilter

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
private ArtifactFilter createArtifactFilter() {
  List<ArtifactFilter> filters = new ArrayList<>(3);

  if (this.scope != null) {
    filters.add(new ScopeArtifactFilter(this.scope));
  }

  if (!this.includes.isEmpty()) {
    filters.add(new StrictPatternIncludesArtifactFilter(this.includes));
  }

  if (!this.excludes.isEmpty()) {
    filters.add(new StrictPatternExcludesArtifactFilter(this.excludes));
  }

  return new AndArtifactFilter(filters);
}
 
開發者ID:ferstl,項目名稱:jitwatch-jarscan-maven-plugin,代碼行數:18,代碼來源:AbstractJarScanMojo.java

示例7: detectExcludedGwtModules

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
/**
 * Detects the GWT modules that should be excluded from the IDE GWT app.
 *
 * @return detected GWT modules
 */
private Set<String> detectExcludedGwtModules() throws IOException {
  Set<String> modules = new HashSet<>();

  ArtifactFilter dependencyFilter = fullIdeArtifact.getDependencyFilter();

  if (dependencyFilter instanceof ExcludesArtifactFilter) {
    ExcludesArtifactFilter excludesDependencyFilter = (ExcludesArtifactFilter) dependencyFilter;

    for (String pattern : excludesDependencyFilter.getPatterns()) {
      String[] split = pattern.split(":");
      String groupId = split[0];
      String artifactId = split[1];
      String version = fullIdeArtifact.getVersion();

      Artifact artifact = repositorySystem.createArtifact(groupId, artifactId, version, "jar");
      String gwtModule = readGwtModuleName(artifact);

      modules.add(gwtModule);

      getLog().info("Detected GWT module to exclude: " + gwtModule);
    }
  }

  return modules;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:31,代碼來源:ProcessExcludesMojo.java

示例8: resolveTransitively

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
public ArtifactResolutionResult resolveTransitively(
    Set<Artifact> artifacts,
    Artifact originatingArtifact,
    ArtifactRepository localRepository,
    List<ArtifactRepository> remoteRepositories,
    ArtifactMetadataSource source,
    ArtifactFilter filter)
    throws ArtifactResolutionException, ArtifactNotFoundException {
  return resolveTransitively(
      artifacts,
      originatingArtifact,
      Collections.EMPTY_MAP,
      localRepository,
      remoteRepositories,
      source,
      filter);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:18,代碼來源:CheArtifactResolver.java

示例9: 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:mojohaus,項目名稱:versions-maven-plugin,代碼行數:27,代碼來源:AbstractVersionsDependencyUpdaterMojo.java

示例10: resolve

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
public Set<Artifact> resolve(String groupId, String artifactId, String version, final String exclusion)
        throws MojoExecutionException {
    ArtifactResolutionRequest request = new ArtifactResolutionRequest()
        .setResolveTransitively(true)
        .setResolveRoot(true)
        .setArtifact(system.createArtifact(groupId, artifactId, version, "jar"))
        .setLocalRepository(this.localRepo)
        .setRemoteRepositories(remoteRepos).setCollectionFilter(new ArtifactFilter() {
            
            @Override
            public boolean include(Artifact artifact) {
                if (exclusion != null && 
                        (artifact.getGroupId() + ":" + artifact.getArtifactId()).equals(exclusion)) {
                    return false;
                }
                return artifact.getScope() == null || artifact.getScope().equals("compile") || artifact.getScope().equals("runtime");
            }
        });

    ArtifactResolutionResult result = system.resolve(request);  
    // TODO error handling
    return result.getArtifacts();
}
 
開發者ID:torquebox,項目名稱:jruby9-maven-plugins,代碼行數:24,代碼來源:ArtifactHelper.java

示例11: 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;
}
 
開發者ID:mojohaus,項目名稱:webstart,代碼行數:29,代碼來源:AbstractJnlpMojo.java

示例12: 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 );
            }
        }
    }
}
 
開發者ID:mojohaus,項目名稱:webstart,代碼行數:31,代碼來源:AbstractJnlpMojo.java

示例13: 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

示例14: createGraphFactory

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
@Override
protected GraphFactory createGraphFactory(ArtifactFilter globalFilter, ArtifactFilter transitiveIncludeExcludeFilter, ArtifactFilter targetFilter, GraphStyleConfigurer graphStyleConfigurer) {

  DependencyNodeIdRenderer nodeIdRenderer = DependencyNodeIdRenderer
      .groupId()
      .withScope(!this.mergeScopes);

  GraphBuilder<DependencyNode> graphBuilder = graphStyleConfigurer
      .showGroupIds(true)
      .showArtifactIds(false)
      .showTypes(false)
      .showClassifiers(false)
      .showVersionsOnNodes(false)
      .showVersionsOnEdges(false)
      .repeatTransitiveDependencies(this.repeatTransitiveDependenciesInTextGraph)
      .configure(GraphBuilder.create(nodeIdRenderer))
      .omitSelfReferences();

  MavenGraphAdapter adapter = new MavenGraphAdapter(this.dependencyGraphBuilder, transitiveIncludeExcludeFilter, targetFilter, this.reduceEdges);

  return new AggregatingGraphFactory(adapter, createReactorOrderSubProjectSupplier(), globalFilter, graphBuilder, true);
}
 
開發者ID:ferstl,項目名稱:depgraph-maven-plugin,代碼行數:23,代碼來源:AggregatingDependencyGraphByGroupIdMojo.java

示例15: createGraphFactory

import org.apache.maven.artifact.resolver.filter.ArtifactFilter; //導入依賴的package包/類
@Override
protected GraphFactory createGraphFactory(ArtifactFilter globalFilter, ArtifactFilter transitiveIncludeExcludeFilter, ArtifactFilter targetFilter, GraphStyleConfigurer graphStyleConfigurer) {

  GraphBuilder<DependencyNode> graphBuilder = graphStyleConfigurer
      .showGroupIds(true)
      .showArtifactIds(false)
      .showTypes(false)
      .showClassifiers(false)
      .showVersionsOnNodes(false)
      .showVersionsOnEdges(false)
      .configure(GraphBuilder.create(DependencyNodeIdRenderer.groupId().withScope(true)))
      .omitSelfReferences();

  MavenGraphAdapter adapter = new MavenGraphAdapter(this.dependencyTreeBuilder, this.localRepository, transitiveIncludeExcludeFilter, targetFilter, allOf(NodeResolution.class));
  return new SimpleGraphFactory(adapter, globalFilter, graphBuilder);
}
 
開發者ID:ferstl,項目名稱:depgraph-maven-plugin,代碼行數:17,代碼來源:DependencyGraphByGroupIdMojo.java


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