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


Java DependencyNode.accept方法代码示例

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


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

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

示例2: getLibraryArtifacts

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
static List<Artifact> getLibraryArtifacts( DependencyNode treeRoot, NetBeansModule module,
                                           List<Artifact> runtimeArtifacts,
                                           Map<Artifact, ExamineManifest> examinerCache, Log log,
                                           boolean useOsgiDependencies )
    throws MojoExecutionException
{
    List<Artifact> include = new ArrayList<Artifact>();
    if ( module != null )
    {
        List<String> librList = new ArrayList<String>();
        if ( module.getLibraries() != null )
        {
            librList.addAll( module.getLibraries() );
        }
        CollectLibrariesNodeVisitor visitor = new CollectLibrariesNodeVisitor( librList,
            runtimeArtifacts, examinerCache, log, treeRoot, useOsgiDependencies );
        treeRoot.accept( visitor );
        include.addAll( visitor.getArtifacts() );
    }
    return include;
}
 
开发者ID:bitstrings,项目名称:nbm-maven,代码行数:22,代码来源:AbstractNbmMojo.java

示例3: getTransitiveDependencies

import org.apache.maven.shared.dependency.graph.DependencyNode; //导入方法依赖的package包/类
/**
 * Collects the transitive dependencies of the current projects.
 *
 * @param mojo  the mojo
 * @param graph the dependency graph builder
 * @return the set of resolved transitive dependencies.
 */
private static Set<Artifact> getTransitiveDependencies(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
                                                       ArtifactFilter filter) {
    Set<Artifact> artifacts;
    artifacts = new LinkedHashSet<>();
    try {
        Set<Artifact> transitives = new LinkedHashSet<>();
        DependencyNode node = graph.buildDependencyGraph(mojo.project, filter);
        node.accept(new ArtifactVisitor(mojo, transitives));
        mojo.getLog().debug(transitives.size() + " transitive dependencies have been collected : " +
                transitives);

        // Unfortunately, the retrieved artifacts are not resolved, we need to find their 'surrogates' in the
        // resolved list.
        Set<Artifact> resolved = mojo.project.getArtifacts();
        for (Artifact a : transitives) {
            Artifact r = getArtifact(a, resolved);
            if (r == null) {
                mojo.getLog().warn("Cannot find resolved artifact for " + a);
            } else {
                artifacts.add(r);
            }
        }
    } catch (DependencyGraphBuilderException e) {
        mojo.getLog().error("Cannot traverse the project's dependencies to collect transitive dependencies, " +
                "ignoring transitive");
        mojo.getLog().debug("Here is the thrown exception having disabled the transitive dependency collection", e);
        artifacts = mojo.project.getDependencyArtifacts();
    }
    return artifacts;
}
 
开发者ID:wisdom-framework,项目名称:wisdom,代码行数:38,代码来源:DependencyCopy.java

示例4: processTransitiveDependencies

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