in src/main/java/org/apache/nifi/NarProvidedDependenciesMojo.java [102:134]
public void execute() throws MojoExecutionException, MojoFailureException {
try {
NarDependencyUtils.ensureSingleNarDependencyExists(project);
// build the project for the nar artifact
final ProjectBuildingRequest narRequest = new DefaultProjectBuildingRequest();
narRequest.setRepositorySession(repoSession);
narRequest.setSystemProperties(System.getProperties());
artifactHandlerManager.addHandlers(NarDependencyUtils.createNarHandlerMap(narRequest, project, projectBuilder));
// get the dependency tree
final DependencyNode root = dependencyGraphBuilder.buildDependencyGraph(narRequest, null);
// write the appropriate output
DependencyNodeVisitor visitor = null;
if ("tree".equals(mode)) {
visitor = new TreeWriter();
} else if ("pom".equals(mode)) {
visitor = new PomWriter();
}
// ensure the mode was specified correctly
if (visitor == null) {
throw new MojoExecutionException("The specified mode is invalid. Supported options are 'tree' and 'pom'.");
}
// visit and print the results
root.accept(visitor);
getLog().info("--- Provided NAR Dependencies ---" + System.lineSeparator() + System.lineSeparator() + visitor);
} catch (ProjectBuildingException | DependencyGraphBuilderException e) {
throw new MojoExecutionException("Cannot build project dependency tree", e);
}
}