当前位置: 首页>>代码示例>>Java>>正文


Java DependencyNode.getChildren方法代码示例

本文整理汇总了Java中org.apache.maven.shared.dependency.graph.DependencyNode.getChildren方法的典型用法代码示例。如果您正苦于以下问题:Java DependencyNode.getChildren方法的具体用法?Java DependencyNode.getChildren怎么用?Java DependencyNode.getChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.maven.shared.dependency.graph.DependencyNode的用法示例。


在下文中一共展示了DependencyNode.getChildren方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllDescendants

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
private Set<Artifact> getAllDescendants( DependencyNode node )
{
    Set<Artifact> children = null; 
    if( node.getChildren() != null )
    {
        children = new HashSet<Artifact>();
        for( DependencyNode depNode : node.getChildren() )
        {
            children.add( depNode.getArtifact() );
            Set<Artifact> subNodes = getAllDescendants( depNode );
            if( subNodes != null )
            {
                children.addAll( subNodes );
            }
        }
    }
    return children;
}
 
开发者ID:mojohaus,项目名称:extra-enforcer-rules,代码行数:19,代码来源:BanCircularDependencies.java

示例2: addPackageDependencies

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
/**
 * Find all of the dependencies for a specified artifact
 */
private List<PackageDescriptor> addPackageDependencies(PackageDescriptor parent, String groupId, String artifactId, String version,
                                                       DependencyNode parentDep) {
    List<PackageDescriptor> packageDependency = new LinkedList<PackageDescriptor>();
    List<DependencyNode> children = parentDep.getChildren();
    if (children != null) {
        for (DependencyNode node : children) {
            DependencyNodeVisitor nlg = new CollectingDependencyNodeVisitor();
            node.accept(nlg);
            List<DependencyNode> deps = ((CollectingDependencyNodeVisitor) nlg).getNodes();
            for (DependencyNode dep : deps) {
                Artifact artifact = dep.getArtifact();
                PackageDescriptor pkgDep = new PackageDescriptor("maven", artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
                // Only include each package once. They might be transitive dependencies from multiple places.
                if (!parents.containsKey(pkgDep)) {
                    pkgDep = request.add("maven", artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
                    parents.put(pkgDep, parent);
                    packageDependency.add(pkgDep);
                }
            }
        }
    }
    return packageDependency;
}
 
开发者ID:OSSIndex,项目名称:ossindex-maven-plugin,代码行数:27,代码来源:DependencyAuditor.java

示例3: traverseDependencyNodes

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
private void traverseDependencyNodes(DependencyNode node, Set<Artifact> transitiveDependencies)
  throws EnforcerRuleException {
  final List<DependencyNode> children = node.getChildren();
  if ((children == null) || children.isEmpty()) {
    return;
  }
  for (DependencyNode child : children) {
    final Artifact artifact = child.getArtifact();
    enforceArtifactResolution(artifact);
    if (logger.isDebugEnabled()) {
      logger.debug("Add dependency '" + artifact.getId() + "'");
    }
    transitiveDependencies.add(artifact);
    traverseDependencyNodes(child, transitiveDependencies);
  }
}
 
开发者ID:ImmobilienScout24,项目名称:illegal-transitive-dependency-check,代码行数:17,代码来源:IllegalTransitiveDependencyCheck.java

示例4: visit

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
/**
 * Visits all nodes from the given node and collects dependencies.
 *
 * @param node          DependencyNode from which to search.
 * @param collecting    Whether we are currently collecting artifacts.
 */
public void visit( DependencyNode node, boolean collecting )
{
    if ( collecting )
    {
        dependencies.add( node.getArtifact() );
    }

    if ( matchesTarget( node.getArtifact() ) )
    {
        collecting = true;
        log.debug( "Found target. Collecting dependencies after " + node.getArtifact() );
    }

    for ( final DependencyNode child : node.getChildren() )
    {
        visit( child, collecting );
    }
}
 
开发者ID:simpligility,项目名称:android-ndk-maven-plugin,代码行数:25,代码来源:DependencyCollector.java

示例5: dependencies

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
/**
 * Retrieve dependencies for from given node and scope.
 * @param node Node to traverse.
 * @param scps Scopes to use.
 * @return Collection of dependency files.
 */
private Collection<String> dependencies(final DependencyNode node,
    final Collection<String> scps) {
    final Artifact artifact = node.getArtifact();
    final Collection<String> files = new LinkedList<String>();
    if (artifact.getScope() == null
        || scps.contains(artifact.getScope())) {
        if (artifact.getScope() == null) {
            files.add(artifact.getFile().toString());
        } else {
            files.add(
                this.session.getLocalRepository().find(artifact).getFile()
                    .toString()
            );
        }
        for (final DependencyNode child : node.getChildren()) {
            if (child.getArtifact().compareTo(node.getArtifact()) != 0) {
                files.addAll(this.dependencies(child, scps));
            }
        }
    }
    return files;
}
 
开发者ID:jcabi,项目名称:jcabi-maven-plugin,代码行数:29,代码来源:AjcMojo.java

示例6: dependencies

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
/**
 * Retrieve dependencies for from given node and scope.
 * @param node Node to traverse.
 * @param scps Scopes to use.
 * @return Collection of dependency files.
 */
private Collection<File> dependencies(final DependencyNode node,
    final Collection<String> scps) {
    final Artifact artifact = node.getArtifact();
    final Collection<File> files = new LinkedList<File>();
    if ((artifact.getScope() == null)
        || scps.contains(artifact.getScope())) {
        if (artifact.getScope() == null) {
            files.add(artifact.getFile());
        } else {
            files.add(
                this.session.getLocalRepository().find(artifact).getFile()
            );
        }
        for (final DependencyNode child : node.getChildren()) {
            if (child.getArtifact().compareTo(node.getArtifact()) != 0) {
                files.addAll(this.dependencies(child, scps));
            }
        }
    }
    return files;
}
 
开发者ID:jcabi,项目名称:jcabi-aether,代码行数:28,代码来源:MavenClasspath.java

示例7: scanDependencies

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
/**
 * Iterates through the dependency graph and throws exceptions if there are non-whitelisted dependencies present
 * @param dependencyNode The root node in the graph to start inspecting.
 * @throws ProjectResolutionException Thrown if project pom files are not read properly, such as in the case of
 * invalid configurations present in a pom file that do not conform to the pom specification.
 * @throws DependencyException Thrown when a dependency does not meet the license whitelist criteria.
 */
public void scanDependencies(DependencyNode dependencyNode) throws ProjectResolutionException, DependencyException {
    if (dependencyNode.getChildren().isEmpty()) {
        checkDependency(dependencyNode);
    } else {
        for (DependencyNode dependency : dependencyNode.getChildren()) {
            scanDependencies(dependency);
        }
    }
}
 
开发者ID:patrickpilch,项目名称:dependency-license-checker,代码行数:17,代码来源:DependencyChecker.java

示例8: checkDepNode

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
private Set<Artifact> checkDepNode(final DependencyNode rootNode,
		final List<ArtifactRepository> repositories, final int level,
		DefaultHttpClient client, MatrixPrinter printer)
		throws MojoFailureException {
	if (!(level < depth))
		return Collections.emptySet();

	HashSet<Artifact> missingArts = new HashSet<Artifact>();
	for (DependencyNode dep : rootNode.getChildren()) {
		Artifact artifact = dep.getArtifact();

		if (!checkSnapshots && artifact.isSnapshot()) {
			printer.printResult(artifact, level, Collections.nCopies(repositories.size(), Result.IGNORED));
		} else {
			final LinkedList<Result> results = new LinkedList<RepositoryCheckerMojo.Result>();
			for (ArtifactRepository repo : repositories) {
				Result result = lookupArtifact(artifact, repo, client);
				results.add(result);
			}

			if (!results.contains(Result.FOUND)) {
				missingArts.add(artifact);
				if (breakOnMissing) {
					throw new MojoFailureException(
							String.format(
									"did not find artifact %s in any of the available repositories",
									artifact.getId()));
				}
			}

			printer.printResult(artifact, level, results);
			missingArts.addAll(checkDepNode(dep, repositories, level + 1, client, printer));
		}
	}
	
	return missingArts;
}
 
开发者ID:apache,项目名称:marmotta,代码行数:38,代码来源:RepositoryCheckerMojo.java

示例9: copyPluginDependency

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
/**
 * Copy the given plugin dependency - and all of its children - to the {@code libext/} directory.
 * 
 * @param dependencyNode
 *            The {@link DependencyNode} whose artifact and children are to be copied.
 * @param libExtDirectory
 *            A {@link File} representing the directory to which the libraries are to be copied.
 * @throws MojoExecutionException
 *             If any errors occur during the copying.
 */
private void copyPluginDependency(DependencyNode dependencyNode, File libExtDirectory) throws MojoExecutionException {
    final Artifact resolvedArtifact = artifactRepository.find(dependencyNode.getArtifact());
    try {
        FileUtils.copyFile(resolvedArtifact.getFile(), new File(libExtDirectory, resolvedArtifact.getFile().getName()));
    } catch (IOException e) {
        throw new MojoExecutionException(String.format("Failed to copy artifact %s to %s.", formatIdentifier(resolvedArtifact), libExtDirectory.getAbsolutePath()), e);
    }
    // Recursively copy all other libraries
    for (DependencyNode child : dependencyNode.getChildren()) {
        copyPluginDependency(child, libExtDirectory);
    }
}
 
开发者ID:jrh3k5,项目名称:flume-plugin-maven-plugin,代码行数:23,代码来源:AbstractFlumePluginMojo.java


注:本文中的org.apache.maven.shared.dependency.graph.DependencyNode.getChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。