Java 类org.apache.maven.plugin.dependency.utils.DependencyStatusSets 实例源码

项目:nifi-maven    文件:NarMojo.java   
protected DependencyStatusSets filterMarkedDependencies(Set artifacts) throws MojoExecutionException {
    // remove files that have markers already
    FilterArtifacts filter = new FilterArtifacts();
    filter.clearFilters();
    filter.addFilter(getMarkedArtifactFilter());

    Set unMarkedArtifacts;
    try {
        unMarkedArtifacts = filter.filter(artifacts);
    } catch (ArtifactFilterException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }

    // calculate the skipped artifacts
    Set skippedArtifacts = new HashSet();
    skippedArtifacts.addAll(artifacts);
    skippedArtifacts.removeAll(unMarkedArtifacts);

    return new DependencyStatusSets(unMarkedArtifacts, null, skippedArtifacts);
}
项目:nifi-maven    文件:NarMojo.java   
private void copyDependencies() throws MojoExecutionException {
    DependencyStatusSets dss = getDependencySets(this.failOnMissingClassifierArtifact);
    Set artifacts = dss.getResolvedDependencies();

    for (Object artifactObj : artifacts) {
        copyArtifact((Artifact) artifactObj);
    }

    artifacts = dss.getSkippedDependencies();
    for (Object artifactOjb : artifacts) {
        Artifact artifact = (Artifact) artifactOjb;
        getLog().info(artifact.getFile().getName() + " already exists in destination.");
    }
}
项目:nifi-maven    文件:NarMojo.java   
protected DependencyStatusSets getDependencySets(boolean stopOnFailure) throws MojoExecutionException {
    // add filters in well known order, least specific to most specific
    FilterArtifacts filter = new FilterArtifacts();

    filter.addFilter(new ProjectTransitivityFilter(project.getDependencyArtifacts(), false));
    filter.addFilter(new ScopeFilter(this.includeScope, this.excludeScope));
    filter.addFilter(new TypeFilter(this.includeTypes, this.excludeTypes));
    filter.addFilter(new ClassifierFilter(this.includeClassifiers, this.excludeClassifiers));
    filter.addFilter(new GroupIdFilter(this.includeGroupIds, this.excludeGroupIds));
    filter.addFilter(new ArtifactIdFilter(this.includeArtifactIds, this.excludeArtifactIds));

    // explicitly filter our nar dependencies
    filter.addFilter(new TypeFilter("", "nar"));

    // start with all artifacts.
    Set artifacts = project.getArtifacts();

    // perform filtering
    try {
        artifacts = filter.filter(artifacts);
    } catch (ArtifactFilterException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }

    // transform artifacts if classifier is set
    final DependencyStatusSets status;
    if (StringUtils.isNotEmpty(copyDepClassifier)) {
        status = getClassifierTranslatedDependencies(artifacts, stopOnFailure);
    } else {
        status = filterMarkedDependencies(artifacts);
    }

    return status;
}
项目:nifi-maven    文件:NarMojo.java   
protected DependencyStatusSets getClassifierTranslatedDependencies(Set artifacts, boolean stopOnFailure) throws MojoExecutionException {
    Set unResolvedArtifacts = new HashSet();
    Set resolvedArtifacts = artifacts;
    DependencyStatusSets status = new DependencyStatusSets();

    // possibly translate artifacts into a new set of artifacts based on the
    // classifier and type
    // if this did something, we need to resolve the new artifacts
    if (StringUtils.isNotEmpty(copyDepClassifier)) {
        ArtifactTranslator translator = new ClassifierTypeTranslator(this.copyDepClassifier, this.type, this.factory);
        artifacts = translator.translate(artifacts, getLog());

        status = filterMarkedDependencies(artifacts);

        // the unskipped artifacts are in the resolved set.
        artifacts = status.getResolvedDependencies();

        // resolve the rest of the artifacts
        ArtifactsResolver artifactsResolver = new DefaultArtifactsResolver(this.resolver, this.local,
                this.remoteRepos, stopOnFailure);
        resolvedArtifacts = artifactsResolver.resolve(artifacts, getLog());

        // calculate the artifacts not resolved.
        unResolvedArtifacts.addAll(artifacts);
        unResolvedArtifacts.removeAll(resolvedArtifacts);
    }

    // return a bean of all 3 sets.
    status.setResolvedDependencies(resolvedArtifacts);
    status.setUnResolvedDependencies(unResolvedArtifacts);

    return status;
}
项目:dependency-check-maven-plugin    文件:DependencyCheckMojo.java   
private Set<Artifact> getAllArtifacts() throws Exception
{
   Set<Artifact> artifacts = new HashSet<Artifact>();

   // all dependencies
   DependencyStatusSets result = this.getDependencySets(false, includeParents);
   if (result.getResolvedDependencies() != null && !result.getResolvedDependencies().isEmpty())
   {
      artifacts.addAll(result.getResolvedDependencies());
   }
   if (result.getSkippedDependencies() != null && !result.getSkippedDependencies().isEmpty())
   {
      artifacts.addAll(result.getSkippedDependencies());
   }
   if (result.getUnResolvedDependencies() != null && !result.getUnResolvedDependencies().isEmpty())
   {
      artifacts.addAll(result.getUnResolvedDependencies());
   }

   // all plugins
   final Set<Artifact> plugins = resolvePluginArtifacts();
   for ( final Artifact plugin : plugins )
   {
      artifacts.add(plugin);
      // adds all plugin dependencies if not exclude transitive
      if (!this.excludeTransitive)
      {
         for ( final Artifact artifact : resolveArtifactDependencies( plugin ) )
         {
            artifacts.add(artifact);
         }
      }
   }
   return artifacts;
}