Just for information, and for me to remember.
Found here :
https://github.com/apache/nifi-maven/blob/master/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoaderFactory.java
private String determineProvidedEntityVersion(final Set<Artifact>
> artifacts, final String groupId, final String artifactId) throws
> ProjectBuildingException, MojoExecutionException {
> getLog().debug("Determining provided entities for " + groupId +
> ":" + artifactId);
> for (final Artifact artifact : artifacts) {
> if (artifact.getGroupId().equals(groupId) &&
> artifact.getArtifactId().equals(artifactId)) {
> return artifact.getVersion();
> }
> }
> return findProvidedDependencyVersion(artifacts, groupId,
> artifactId);
> }
> private String findProvidedDependencyVersion(final Set<Artifact>
> artifacts, final String groupId, final String artifactId) {
> final ProjectBuildingRequest projectRequest = new
> DefaultProjectBuildingRequest();
> projectRequest.setRepositorySession(repoSession);
> projectRequest.setSystemProperties(System.getProperties());
> projectRequest.setLocalRepository(localRepo);
> for (final Artifact artifact : artifacts) {
> final Set<Artifact> artifactDependencies = new HashSet<>();
> try {
> final ProjectBuildingResult projectResult =
> projectBuilder.build(artifact, projectRequest);
> gatherArtifacts(projectResult.getProject(),
> artifactDependencies);
> 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 " + artifact.getVersion());
> return artifact.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;
> }
Should not be return dependency.getVersion() ?
Because the artifact is the currently parsed artifact and not the
dependency one ?
Le ven. 19 juin 2020 à 09:35, Etienne Jouvin <[email protected]> a
écrit :
> Hello all.
>
> Do not know where to post the message, guide me if I should send to
> another mailing list.
> A simple summary in first step.
> I created a simple project to build a new service.
> I extend the nifi-nar-bundles artifact with version 1.11.4.
> My project version is currently 0.0.1-SNAPSHOT.
>
> During NAR generation, it failed for the documentation with message :
> org.apache.maven.plugin.MojoExecutionException: Failed to create Extension
> Documentation
> Caused by: org.apache.maven.plugin.MojoExecutionException: Could not
> resolve local dependency org.apache.nifi:nifi-api:jar:0.0.1-SNAPSHOT
>
> I am currently looking in source code of nifi-maven project, specially
> class ExtensionClassLoaderFactory.
>
> What I do not understand is why it searches for version 0.0.1-SNAPSHOT on
> nifi-api, and not the version 1.11.4
>
> Let me know if I should discuss about this in another thread.
>
> Regards
>
> Etienne
>