diff --git a/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoaderFactory.java b/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoaderFactory.java index ace4226..1a71e24 100644 --- a/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoaderFactory.java +++ b/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoaderFactory.java @@ -239,23 +239,25 @@ private Artifact getProvidedArtifact(final String groupId, final String artifact private ExtensionClassLoader createProvidedEntitiesClassLoader(final ArtifactsHolder artifactsHolder) throws MojoExecutionException, ProjectBuildingException { + final Set providedArtifacts = new HashSet<>(); + final String nifiApiVersion = determineProvidedEntityVersion(artifactsHolder.getAllArtifacts(), "org.apache.nifi", "nifi-api"); if (nifiApiVersion == null) { throw new MojoExecutionException("Could not find any dependency, provided or otherwise, on [org.apache.nifi:nifi-api]"); } else { getLog().info("Found a dependency on version " + nifiApiVersion + " of NiFi API"); } - - final String slf4jApiVersion = determineProvidedEntityVersion(artifactsHolder.getAllArtifacts(),"org.slf4j", "slf4j-api"); - final Artifact nifiApiArtifact = getProvidedArtifact("org.apache.nifi", "nifi-api", nifiApiVersion); - final Artifact nifiFrameworkApiArtifact = getProvidedArtifact("org.apache.nifi", "nifi-framework-api", nifiApiArtifact.getVersion()); + providedArtifacts.add(nifiApiArtifact); - final Artifact slf4jArtifact = getProvidedArtifact("org.slf4j", "slf4j-api", slf4jApiVersion); + final String nifiFrameworkApiVersion = determineProvidedEntityVersion(artifactsHolder.getAllArtifacts(),"org.apache.nifi", "nifi-framework-api"); + if (nifiFrameworkApiVersion != null) { + final Artifact nifiFrameworkApiArtifact = getProvidedArtifact("org.apache.nifi", "nifi-framework-api", nifiFrameworkApiVersion); + providedArtifacts.add(nifiFrameworkApiArtifact); + } - final Set providedArtifacts = new HashSet<>(); - providedArtifacts.add(nifiApiArtifact); - providedArtifacts.add(nifiFrameworkApiArtifact); + final String slf4jApiVersion = determineProvidedEntityVersion(artifactsHolder.getAllArtifacts(),"org.slf4j", "slf4j-api"); + final Artifact slf4jArtifact = getProvidedArtifact("org.slf4j", "slf4j-api", slf4jApiVersion); providedArtifacts.add(slf4jArtifact); getLog().debug("Creating Provided Entities Class Loader with artifacts: " + providedArtifacts);