in src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoaderFactory.java [172:195]
private String findProvidedDependencyVersion(final Set<Artifact> artifacts, final String groupId, final String artifactId) {
final ProjectBuildingRequest projectRequest = createProjectBuildingRequest();
for (final Artifact artifact : artifacts) {
try {
final ProjectBuildingResult projectResult = projectBuilder.build(artifact, projectRequest);
final Set<Artifact> artifactDependencies = gatherArtifacts(projectResult.getProject(), HashSet::new);
getLog().debug("For Artifact " + artifact + ", found the following dependencies:");
artifactDependencies.forEach(dep -> getLog().debug(dep.toString()));
for (final Artifact dependency : artifactDependencies) {
if (dependency.getGroupId().equals(groupId) && dependency.getArtifactId().equals(artifactId)) {
getLog().debug("Found version of " + groupId + ":" + artifactId + " to be " + dependency.getVersion());
return dependency.getVersion();
}
}
} catch (final Exception e) {
getLog().warn("Unable to construct Maven Project for " + artifact + " when attempting to determine the expected version of NiFi API");
getLog().debug("Unable to construct Maven Project for " + artifact + " when attempting to determine the expected version of NiFi API", e);
}
}
return null;
}