in nbm-maven-plugin/src/main/java/org/apache/netbeans/nbm/CollectModuleLibrariesNodeVisitor.java [93:152]
public boolean visit(DependencyNode node) {
if (throwable != null) {
return false;
}
if (root == node) {
return true;
}
try {
Artifact artifact = node.getArtifact();
if (!artifacts.containsKey(artifact.getDependencyConflictId())) {
//ignore non-runtime stuff..
return false;
}
// somehow the transitive artifacts in the tree are not always resolved?
artifact = artifacts.get(artifact.getDependencyConflictId());
ExamineManifest depExaminator = examinerCache.get(artifact);
if (depExaminator == null) {
depExaminator = new ExamineManifest(log);
depExaminator.setArtifactFile(artifact.getFile());
depExaminator.checkFile();
examinerCache.put(artifact, depExaminator);
}
if (depExaminator.isNetBeansModule() || (useOSGiDependencies && depExaminator.isOsgiBundle())) {
currentModule.push(artifact.getDependencyConflictId());
ArrayList<Artifact> arts = new ArrayList<Artifact>();
arts.add(artifact);
if (currentModule.size() == 1) {
directNodes.put(currentModule.peek(), arts);
} else {
transitiveNodes.put(currentModule.peek(), arts);
}
return true;
}
if (currentModule.size() > 0) {
////MNBMODULE-95 we are only interested in the module owned libraries
if (!currentModule.peek().startsWith(LIB_ID)
&& AbstractNbmMojo.
matchesLibrary(artifact, Collections.<String>emptyList(), depExaminator, log,
useOSGiDependencies)) {
if (currentModule.size() == 1) {
directNodes.get(currentModule.peek()).add(artifact);
} else {
transitiveNodes.get(currentModule.peek()).add(artifact);
}
// if a library, iterate to it's child nodes.
return true;
}
} else {
//MNBMODULE-95 we check the non-module dependencies to see if they
// depend on modules/bundles. these bundles are transitive, so
// we add the root module as the first currentModule to keep
//any bundle/module underneath it as transitive
currentModule.push(LIB_ID + artifact.getDependencyConflictId());
}
} catch (MojoExecutionException mojoExecutionException) {
throwable = mojoExecutionException;
}
return true;
}