You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by kd...@apache.org on 2019/02/13 20:07:07 UTC

[nifi-maven] 20/20: NIFI-5859

This is an automated email from the ASF dual-hosted git repository.

kdoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-maven.git

commit 438612e8e30015441d3e5394d60067ccc75aa914
Author: Bryan Bende <bb...@apache.org>
AuthorDate: Fri Feb 1 16:50:58 2019 -0500

    NIFI-5859
    
    - Removing unused code that was moved to nifi-api, refactored logic for traversing dependencies
    - Added option to fail build if doc generation fails through enforceDocGeneration property on plugin configuration
    
    This closes #8.
    
    Signed-off-by: Kevin Doran <kd...@apache.org>
---
 src/main/java/org/apache/nifi/NarMojo.java         |  36 ++---
 .../apache/nifi/PropertiesDefinitionWriter.java    |  75 ----------
 .../java/org/apache/nifi/XmlDefinitionWriter.java  | 165 ---------------------
 .../extension/definition/ExtensionDefinition.java  |  15 +-
 .../nifi/extension/definition/Restriction.java     |  29 ----
 .../nifi/extension/definition/Restrictions.java    |  31 ----
 .../extraction/ExtensionClassLoader.java           |  10 +-
 .../extraction/ExtensionClassLoaderFactory.java    |  93 +++++-------
 .../extraction/ExtensionDefinitionFactory.java     | 112 +-------------
 .../extraction/StandardExtensionDefinition.java    |  26 +---
 .../definition/extraction/StandardRestriction.java |  39 -----
 .../extraction/StandardRestrictions.java           |  42 ------
 12 files changed, 71 insertions(+), 602 deletions(-)

diff --git a/src/main/java/org/apache/nifi/NarMojo.java b/src/main/java/org/apache/nifi/NarMojo.java
index 85ebfcf..3627adf 100644
--- a/src/main/java/org/apache/nifi/NarMojo.java
+++ b/src/main/java/org/apache/nifi/NarMojo.java
@@ -34,7 +34,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolver;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.dependency.utils.DependencyStatusSets;
 import org.apache.maven.plugin.dependency.utils.DependencyUtil;
 import org.apache.maven.plugin.dependency.utils.filters.DestFileFilter;
@@ -50,6 +49,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingException;
 import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException;
 import org.apache.maven.shared.artifact.filter.collection.ArtifactIdFilter;
 import org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter;
@@ -76,19 +76,11 @@ import org.eclipse.aether.RepositorySystemSession;
 
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamWriter;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.OutputStream;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -479,6 +471,9 @@ public class NarMojo extends AbstractMojo {
     protected boolean cloneDuringInstanceClassLoading;
 
 
+    @Parameter(property = "enforceDocGeneration", defaultValue = "false", required = false)
+    protected boolean enforceDocGeneration;
+
     /**
      * The {@link RepositorySystemSession} used for obtaining the local and remote artifact repositories.
      */
@@ -501,7 +496,12 @@ public class NarMojo extends AbstractMojo {
         try {
             generateDocumentation();
         } catch (final Throwable t) { // Catch Throwable in case a linkage error such as NoClassDefFoundError occurs
-            getLog().warn("Could not generate extensions' documentation", t);
+            if (enforceDocGeneration) {
+                getLog().error("Could not generate extensions' documentation", t);
+                throw t;
+            } else {
+                getLog().warn("Could not generate extensions' documentation", t);
+            }
         }
 
         makeNar();
@@ -522,14 +522,17 @@ public class NarMojo extends AbstractMojo {
         try {
             extensionClassLoader = classLoaderFactory.createExtensionClassLoader();
         } catch (final Exception e) {
-            if (getLog().isDebugEnabled()) {
-                getLog().debug("Unable to create a ClassLoader for documenting extensions. If this NAR contains any NiFi Extensions, those extensions will not be documented.", e);
+            if (enforceDocGeneration) {
+                throw new MojoExecutionException("Failed to create Extension Documentation", e);
             } else {
-                getLog().warn("Unable to create a ClassLoader for documenting extensions. If this NAR contains any NiFi Extensions, those extensions will not be documented. " +
-                    "Enable mvn DEBUG output for more information (mvn -X).");
+                if (getLog().isDebugEnabled()) {
+                    getLog().debug("Unable to create a ClassLoader for documenting extensions. If this NAR contains any NiFi Extensions, those extensions will not be documented.", e);
+                } else {
+                    getLog().warn("Unable to create a ClassLoader for documenting extensions. If this NAR contains any NiFi Extensions, those extensions will not be documented. " +
+                            "Enable mvn DEBUG output for more information (mvn -X).");
+                }
+                return;
             }
-
-            return;
         }
 
 
@@ -715,7 +718,6 @@ public class NarMojo extends AbstractMojo {
             .log(getLog())
             .project(project)
             .projectBuilder(projectBuilder)
-            .remoteRepositories(remoteRepos)
             .repositorySession(repoSession)
             .artifactHandlerManager(artifactHandlerManager)
             .build();
diff --git a/src/main/java/org/apache/nifi/PropertiesDefinitionWriter.java b/src/main/java/org/apache/nifi/PropertiesDefinitionWriter.java
deleted file mode 100644
index 402d18c..0000000
--- a/src/main/java/org/apache/nifi/PropertiesDefinitionWriter.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi;
-
-import org.apache.nifi.extension.definition.ExtensionDefinition;
-import org.apache.nifi.extension.definition.Restriction;
-import org.apache.nifi.extension.definition.Restrictions;
-import org.apache.nifi.extension.definition.ServiceAPIDefinition;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Objects;
-import java.util.Properties;
-
-public class PropertiesDefinitionWriter {
-
-    public void writeDefinition(final ExtensionDefinition definition, final File file) throws IOException {
-        Objects.requireNonNull(definition);
-
-        final String capabilityDescription = definition.getCapabilityDescription();
-
-        final Properties properties = new Properties();
-        if (capabilityDescription != null) {
-            properties.setProperty("capability.description", capabilityDescription);
-        }
-
-        int i=0;
-        for (final String tag : definition.getTags()) {
-            properties.setProperty("tags." + (i++), tag);
-        }
-
-        final Restrictions restrictions = definition.getRestrictions();
-        if (restrictions != null) {
-            final String restrictedDescription = restrictions.getGeneralRestrictionExplanation();
-
-            if (restrictedDescription != null) {
-                properties.setProperty("restricted.description", restrictedDescription);
-            }
-
-            for (final Restriction restriction : restrictions.getRestrictions()) {
-                properties.setProperty("restriction." + restriction.getIdentifier(), restriction.getExplanation());
-            }
-        }
-
-        int serviceIndex = 0;
-        for (final ServiceAPIDefinition apiDefinition : definition.getProvidedServiceAPIs()) {
-            properties.setProperty("service.definition." + serviceIndex + ".class", apiDefinition.getServiceAPIClassName());
-            properties.setProperty("service.definition." + serviceIndex + ".groupId", apiDefinition.getServiceGroupId());
-            properties.setProperty("service.definition." + serviceIndex + ".artifactId", apiDefinition.getServiceArtifactId());
-            properties.setProperty("service.definition." + serviceIndex + ".version", apiDefinition.getServiceVersion());
-
-            serviceIndex++;
-        }
-
-        try (final OutputStream fos = new FileOutputStream(file)) {
-            properties.store(fos, null);
-        }
-    }
-}
diff --git a/src/main/java/org/apache/nifi/XmlDefinitionWriter.java b/src/main/java/org/apache/nifi/XmlDefinitionWriter.java
deleted file mode 100644
index 3e91061..0000000
--- a/src/main/java/org/apache/nifi/XmlDefinitionWriter.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi;
-
-import org.apache.nifi.extension.definition.ExtensionDefinition;
-import org.apache.nifi.extension.definition.ExtensionType;
-import org.apache.nifi.extension.definition.Restriction;
-import org.apache.nifi.extension.definition.Restrictions;
-import org.apache.nifi.extension.definition.ServiceAPIDefinition;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-public class XmlDefinitionWriter {
-
-    public void writeDefinition(final Collection<ExtensionDefinition> definitions, final File file) throws IOException {
-        final Map<ExtensionType, List<ExtensionDefinition>> definitionMap = definitions.stream()
-            .collect(Collectors.groupingBy(ExtensionDefinition::getExtensionType));
-
-        writeDefinition(definitionMap, file);
-    }
-
-    public void writeDefinition(final Map<ExtensionType, ? extends Collection<ExtensionDefinition>> definitions, final File file) throws IOException {
-        Objects.requireNonNull(definitions);
-        Objects.requireNonNull(file);
-
-        if (definitions.isEmpty()) {
-            return;
-        }
-
-        try (final OutputStream fileOut = new FileOutputStream(file)) {
-             final XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(fileOut, "UTF-8");
-             try {
-                 writer.writeStartElement("extensions");
-
-                 writer.writeStartElement("processors");
-                 writeDefinitions(ExtensionType.PROCESSOR, definitions.get(ExtensionType.PROCESSOR), writer);
-                 writer.writeEndElement();
-
-                 writer.writeStartElement("controllerServices");
-                 writeDefinitions(ExtensionType.CONTROLLER_SERVICE, definitions.get(ExtensionType.CONTROLLER_SERVICE), writer);
-                 writer.writeEndElement();
-
-                 writer.writeStartElement("reportingTasks");
-                 writeDefinitions(ExtensionType.REPORTING_TASK, definitions.get(ExtensionType.REPORTING_TASK), writer);
-                 writer.writeEndElement();
-
-                 writer.writeEndElement();
-             } finally {
-                 writer.close();
-             }
-        } catch (XMLStreamException e) {
-            throw new IOException(e);
-        }
-    }
-
-    private void writeDefinitions(final ExtensionType extensionType, final Collection<ExtensionDefinition> definitions, final XMLStreamWriter writer) throws XMLStreamException {
-        if (definitions == null) {
-            return;
-        }
-
-        final String tagName;
-        switch (extensionType) {
-            case PROCESSOR:
-                tagName = "processor";
-                break;
-            case CONTROLLER_SERVICE:
-                tagName = "controllerService";
-                break;
-            case REPORTING_TASK:
-                tagName = "reportingTask";
-                break;
-            default:
-                throw new AssertionError("Encountered unknown Extension Type " + extensionType);
-        }
-
-        for (final ExtensionDefinition definition : definitions) {
-            writer.writeStartElement(tagName);
-
-            writeTextElement(writer, "name", definition.getExtensionName());
-            writeTextElement(writer, "description", definition.getCapabilityDescription());
-
-            writer.writeStartElement("tags");
-            for (final String tag : definition.getTags()) {
-                writeTextElement(writer, "tag", tag);
-            }
-            writer.writeEndElement();
-
-            final Restrictions restrictions = definition.getRestrictions();
-            if (restrictions == null) {
-                writer.writeEmptyElement("restrictions");
-            } else {
-                writer.writeStartElement("restrictions");
-
-                writeTextElement(writer, "explanation", restrictions.getGeneralRestrictionExplanation());
-                final Set<Restriction> specificRestrictions = restrictions.getRestrictions();
-                for (final Restriction restriction : specificRestrictions) {
-                    writer.writeStartElement("restriction");
-                    writeTextElement(writer, "identifier", restriction.getIdentifier());
-                    writeTextElement(writer, "explanation", restriction.getExplanation());
-                    writer.writeEndElement();
-                }
-
-                writer.writeEndElement();
-            }
-
-            if (extensionType == ExtensionType.CONTROLLER_SERVICE) {
-                writer.writeStartElement("providedServiceAPIs");
-
-                final Set<ServiceAPIDefinition> serviceDefinitions = definition.getProvidedServiceAPIs();
-                if (serviceDefinitions != null) {
-                    for (final ServiceAPIDefinition serviceDefinition : serviceDefinitions) {
-                        writer.writeStartElement("service");
-
-                        writeTextElement(writer, "className", serviceDefinition.getServiceAPIClassName());
-                        writeTextElement(writer, "groupId", serviceDefinition.getServiceGroupId());
-                        writeTextElement(writer, "artifactId", serviceDefinition.getServiceArtifactId());
-                        writeTextElement(writer, "version", serviceDefinition.getServiceVersion());
-
-                        writer.writeEndElement();
-                    }
-                }
-
-                writer.writeEndElement();
-            }
-
-            writer.writeEndElement();
-        }
-    }
-
-    private void writeTextElement(final XMLStreamWriter writer, final String tagName, final String text) throws XMLStreamException {
-        writer.writeStartElement(tagName);
-
-        if (text != null) {
-            writer.writeCharacters(text);
-        }
-
-        writer.writeEndElement();
-    }
-}
diff --git a/src/main/java/org/apache/nifi/extension/definition/ExtensionDefinition.java b/src/main/java/org/apache/nifi/extension/definition/ExtensionDefinition.java
index 8c0bc40..cbff75e 100644
--- a/src/main/java/org/apache/nifi/extension/definition/ExtensionDefinition.java
+++ b/src/main/java/org/apache/nifi/extension/definition/ExtensionDefinition.java
@@ -19,20 +19,6 @@ package org.apache.nifi.extension.definition;
 import java.util.Set;
 
 public interface ExtensionDefinition {
-    /**
-     * @return the extension's capability description
-     */
-    String getCapabilityDescription();
-
-    /**
-     * @return the set of Tags associated with the extension
-     */
-    Set<String> getTags();
-
-    /**
-     * @return the Restrictions that are placed on the Extension
-     */
-    Restrictions getRestrictions();
 
     /**
      * @return the type of Extension
@@ -49,4 +35,5 @@ public interface ExtensionDefinition {
      * @return the name of the Extension
      */
     String getExtensionName();
+
 }
diff --git a/src/main/java/org/apache/nifi/extension/definition/Restriction.java b/src/main/java/org/apache/nifi/extension/definition/Restriction.java
deleted file mode 100644
index 9b5064c..0000000
--- a/src/main/java/org/apache/nifi/extension/definition/Restriction.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.extension.definition;
-
-public interface Restriction {
-    /**
-     * @return the Restriction identifier used by NiFi
-     */
-    String getIdentifier();
-
-    /**
-     * @return an Explanation of why the Restriction exists.
-     */
-    String getExplanation();
-}
diff --git a/src/main/java/org/apache/nifi/extension/definition/Restrictions.java b/src/main/java/org/apache/nifi/extension/definition/Restrictions.java
deleted file mode 100644
index 5e098fb..0000000
--- a/src/main/java/org/apache/nifi/extension/definition/Restrictions.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.extension.definition;
-
-import java.util.Set;
-
-public interface Restrictions {
-    /**
-     * @return if the extension has a General Restriction on it, this explains why the Restriction is in place.
-     */
-    String getGeneralRestrictionExplanation();
-
-    /**
-     * @return the set of all specific Restrictions that are placed on this extension.
-     */
-    Set<Restriction> getRestrictions();
-}
diff --git a/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoader.java b/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoader.java
index 12f02ac..cdc531a 100644
--- a/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoader.java
+++ b/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionClassLoader.java
@@ -34,7 +34,9 @@ public class ExtensionClassLoader extends URLClassLoader {
         this.urls = urls;
         this.narArtifact = narArtifact;
         this.allArtifacts = new ArrayList<>(otherArtifacts);
-        allArtifacts.add(narArtifact);
+        if (narArtifact != null) {
+            allArtifacts.add(narArtifact);
+        }
     }
 
     public ExtensionClassLoader(final URL[] urls, final Artifact narArtifact, final Collection<Artifact> otherArtifacts) {
@@ -42,7 +44,9 @@ public class ExtensionClassLoader extends URLClassLoader {
         this.urls = urls;
         this.narArtifact = narArtifact;
         this.allArtifacts = new ArrayList<>(otherArtifacts);
-        allArtifacts.add(narArtifact);
+        if (narArtifact != null) {
+            allArtifacts.add(narArtifact);
+        }
     }
 
     public String getNiFiApiVersion() {
@@ -55,7 +59,7 @@ public class ExtensionClassLoader extends URLClassLoader {
 
         final ClassLoader parent = getParent();
         if (parent instanceof ExtensionClassLoader) {
-            ((ExtensionClassLoader) parent).getNiFiApiVersion();
+            return ((ExtensionClassLoader) parent).getNiFiApiVersion();
         }
 
         return null;
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 7b2e5f7..1147698 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
@@ -42,13 +42,14 @@ import org.eclipse.aether.RepositorySystemSession;
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
+import java.util.TreeSet;
 
 public class ExtensionClassLoaderFactory {
     private final Log log;
@@ -56,7 +57,6 @@ public class ExtensionClassLoaderFactory {
     private final RepositorySystemSession repoSession;
     private final ProjectBuilder projectBuilder;
     private final ArtifactRepository localRepo;
-    private final List<ArtifactRepository> remoteRepos;
     private final DependencyTreeBuilder dependencyTreeBuilder;
     private final ArtifactResolver artifactResolver;
     private final ArtifactHandlerManager artifactHandlerManager;
@@ -67,7 +67,6 @@ public class ExtensionClassLoaderFactory {
         this.repoSession = builder.repositorySession;
         this.projectBuilder = builder.projectBuilder;
         this.localRepo = builder.localRepo;
-        this.remoteRepos = new ArrayList<>(builder.remoteRepos);
         this.dependencyTreeBuilder = builder.dependencyTreeBuilder;
         this.artifactResolver = builder.artifactResolver;
         this.artifactHandlerManager = builder.artifactHandlerManager;
@@ -77,25 +76,18 @@ public class ExtensionClassLoaderFactory {
         return log;
     }
 
-    public ExtensionClassLoader createExtensionClassLoader() throws MojoExecutionException {
-        final Set<Artifact> artifacts = new HashSet<>();
-        gatherArtifacts(project, artifacts);
-
-        getLog().debug("Project artifacts: ");
-        artifacts.forEach(artifact -> getLog().debug(artifact.toString()));
-
+    public ExtensionClassLoader createExtensionClassLoader() throws MojoExecutionException, ProjectBuildingException {
         final Artifact narArtifact = project.getArtifact();
+        final Set<Artifact> narArtifacts = getNarDependencies(narArtifact);
 
-        final VersionLookup versionLookup = (group, artifact) -> {
-            try {
-                return determineProvidedEntityVersion(artifacts, group, artifact);
-            } catch (final Exception e) {
-                throw new RuntimeException("Failed to determine provided version of NiFi dependencies", e);
-            }
-        };
+        final ArtifactsHolder artifactsHolder = new ArtifactsHolder();
+        artifactsHolder.addArtifacts(narArtifacts);
+
+        getLog().debug("Project artifacts: ");
+        narArtifacts.forEach(artifact -> getLog().debug(artifact.getArtifactId()));
 
-        final ClassLoader parentClassLoader = createClassLoader(artifacts, versionLookup);
-        final ExtensionClassLoader classLoader = createClassLoader(artifacts, parentClassLoader, narArtifact);
+        final ExtensionClassLoader parentClassLoader = createClassLoader(narArtifacts, artifactsHolder);
+        final ExtensionClassLoader classLoader = createClassLoader(narArtifacts, parentClassLoader, narArtifact);
 
         if (getLog().isDebugEnabled()) {
             getLog().debug("Full ClassLoader is:\n" + classLoader.toTree());
@@ -104,15 +96,19 @@ public class ExtensionClassLoaderFactory {
         return classLoader;
     }
 
-    private ClassLoader createClassLoader(final Set<Artifact> artifacts, final VersionLookup versionLookup) throws MojoExecutionException {
+    private ExtensionClassLoader createClassLoader(final Set<Artifact> artifacts, final ArtifactsHolder artifactsHolder)
+            throws MojoExecutionException, ProjectBuildingException {
+
         final Artifact nar = removeNarArtifact(artifacts);
         if (nar == null) {
-            final ClassLoader providedEntityClassLoader = createProvidedEntitiesClassLoader(versionLookup);
-            return createUrlClassLoader(artifacts, providedEntityClassLoader);
+            final ExtensionClassLoader providedEntityClassLoader = createProvidedEntitiesClassLoader(artifactsHolder);
+            return createClassLoader(artifacts, providedEntityClassLoader, null);
         }
 
         final Set<Artifact> narDependencies = getNarDependencies(nar);
-        return createClassLoader(narDependencies, createClassLoader(narDependencies, versionLookup), nar);
+        artifactsHolder.addArtifacts(narDependencies);
+
+        return createClassLoader(narDependencies, createClassLoader(narDependencies, artifactsHolder), nar);
     }
 
 
@@ -141,7 +137,7 @@ public class ExtensionClassLoaderFactory {
         narRequest.setRepositorySession(repoSession);
         narRequest.setSystemProperties(System.getProperties());
 
-        final Set<Artifact> narDependencies = new HashSet<>();
+        final Set<Artifact> narDependencies = new TreeSet<>();
 
         try {
             final ProjectBuildingResult narResult = projectBuilder.build(narArtifact, narRequest);
@@ -213,7 +209,6 @@ public class ExtensionClassLoaderFactory {
 
         final ArtifactResolutionRequest request = new ArtifactResolutionRequest();
         request.setLocalRepository(localRepo);
-        request.setRemoteRepositories(remoteRepos);
         request.setArtifact(artifact);
 
         final ArtifactResolutionResult result = artifactResolver.resolve(request);
@@ -241,15 +236,17 @@ public class ExtensionClassLoaderFactory {
         return sorted.get(0);
     }
 
-    private ClassLoader createProvidedEntitiesClassLoader(final VersionLookup versionLookup) throws MojoExecutionException {
-        final String nifiApiVersion = versionLookup.getVersion("org.apache.nifi", "nifi-api");
+    private ExtensionClassLoader createProvidedEntitiesClassLoader(final ArtifactsHolder artifactsHolder)
+            throws MojoExecutionException, ProjectBuildingException {
+
+        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 = versionLookup.getVersion("org.slf4j", "slf4j-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());
@@ -262,23 +259,10 @@ public class ExtensionClassLoaderFactory {
         providedArtifacts.add(slf4jArtifact);
 
         getLog().debug("Creating Provided Entities Class Loader with artifacts: " + providedArtifacts);
-        return createUrlClassLoader(providedArtifacts, null);
+        return createClassLoader(providedArtifacts, null, null);
     }
 
-    private ClassLoader createUrlClassLoader(final Set<Artifact> artifacts, final ClassLoader parent) throws MojoExecutionException {
-        final Set<URL> urls = new HashSet<>();
-        for (final Artifact artifact : artifacts) {
-            final Set<URL> artifactUrls = toURLs(artifact);
-            urls.addAll(artifactUrls);
-        }
-
-        getLog().debug("Creating class loader with following dependencies: " + urls);
-
-        final URL[] urlArray = urls.toArray(new URL[0]);
-        return new URLClassLoader(urlArray, parent);
-    }
-
-    private ExtensionClassLoader createClassLoader(final Set<Artifact> artifacts, final ClassLoader parent, final Artifact narArtifact) throws MojoExecutionException {
+    private ExtensionClassLoader createClassLoader(final Set<Artifact> artifacts, final ExtensionClassLoader parent, final Artifact narArtifact) throws MojoExecutionException {
         final Set<URL> urls = new HashSet<>();
         for (final Artifact artifact : artifacts) {
             final Set<URL> artifactUrls = toURLs(artifact);
@@ -330,7 +314,6 @@ public class ExtensionClassLoaderFactory {
 
             final ArtifactResolutionRequest request = new ArtifactResolutionRequest();
             request.setLocalRepository(localRepo);
-            request.setRemoteRepositories(remoteRepos);
             request.setArtifact(artifact);
 
             final ArtifactResolutionResult result = artifactResolver.resolve(request);
@@ -338,7 +321,7 @@ public class ExtensionClassLoaderFactory {
                 throw new MojoExecutionException("Could not resolve local dependency " + artifact);
             }
 
-            getLog().info("Resolved Artifact " + artifact + " to " + result.getArtifacts());
+            getLog().debug("Resolved Artifact " + artifact + " to " + result.getArtifacts());
 
             for (final Artifact resolved : result.getArtifacts()) {
                 urls.addAll(toURLs(resolved));
@@ -362,7 +345,6 @@ public class ExtensionClassLoaderFactory {
         private Log log;
         private MavenProject project;
         private ArtifactRepository localRepo;
-        private List<ArtifactRepository> remoteRepos;
         private DependencyTreeBuilder dependencyTreeBuilder;
         private ArtifactResolver artifactResolver;
         private ProjectBuilder projectBuilder;
@@ -389,11 +371,6 @@ public class ExtensionClassLoaderFactory {
             return this;
         }
 
-        public Builder remoteRepositories(final List<ArtifactRepository> remoteRepos) {
-            this.remoteRepos = remoteRepos;
-            return this;
-        }
-
         public Builder dependencyTreeBuilder(final DependencyTreeBuilder dependencyTreeBuilder) {
             this.dependencyTreeBuilder = dependencyTreeBuilder;
             return this;
@@ -419,8 +396,18 @@ public class ExtensionClassLoaderFactory {
         }
     }
 
+    private static class ArtifactsHolder {
 
-    private interface VersionLookup {
-        String getVersion(String groupId, String artifactId);
+        private Set<Artifact> allArtifacts = new TreeSet<>();
+
+        public void addArtifacts(final Set<Artifact> artifacts) {
+            if (artifacts != null) {
+                allArtifacts.addAll(artifacts);
+            }
+        }
+
+        public Set<Artifact> getAllArtifacts() {
+            return allArtifacts;
+        }
     }
 }
diff --git a/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionDefinitionFactory.java b/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionDefinitionFactory.java
index d0aee68..6203493 100644
--- a/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionDefinitionFactory.java
+++ b/src/main/java/org/apache/nifi/extension/definition/extraction/ExtensionDefinitionFactory.java
@@ -17,11 +17,8 @@
 package org.apache.nifi.extension.definition.extraction;
 
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.nifi.extension.definition.ExtensionDefinition;
 import org.apache.nifi.extension.definition.ExtensionType;
-import org.apache.nifi.extension.definition.Restriction;
-import org.apache.nifi.extension.definition.Restrictions;
 import org.apache.nifi.extension.definition.ServiceAPIDefinition;
 
 import java.io.BufferedReader;
@@ -29,9 +26,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -39,8 +33,6 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 public class ExtensionDefinitionFactory {
     private static final String SERVICES_DIRECTORY = "META-INF/services/";
@@ -78,17 +70,10 @@ public class ExtensionDefinitionFactory {
         return definitions;
     }
 
-    private ExtensionDefinition createExtensionDefinition(final ExtensionType extensionType, final String className) throws ClassNotFoundException,
-                IllegalAccessException, NoSuchMethodException, InvocationTargetException {
-
+    private ExtensionDefinition createExtensionDefinition(final ExtensionType extensionType, final String className) throws ClassNotFoundException {
         final Class<?> extensionClass = Class.forName(className, false, extensionClassLoader);
-
-        final String capabilityDescription = getCapabilityDescription(extensionClass);
-        final Set<String> tags = getTags(extensionClass);
-        final Restrictions restrictions = getRestrictions(extensionClass);
         final Set<ServiceAPIDefinition> serviceApis = getProvidedServiceAPIs(extensionType, extensionClass);
-
-        return new StandardExtensionDefinition(extensionType, className, capabilityDescription, tags, restrictions, serviceApis);
+        return new StandardExtensionDefinition(extensionType, className, serviceApis);
     }
 
     private Set<ServiceAPIDefinition> getProvidedServiceAPIs(final ExtensionType extensionType, final Class<?> extensionClass) throws ClassNotFoundException {
@@ -116,99 +101,6 @@ public class ExtensionDefinitionFactory {
         return serviceApis;
     }
 
-    private Restrictions getRestrictions(final Class<?> extensionClass) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
-        final String restrictedDescription = getRestrictedDescription(extensionClass);
-        final Map<String, String> specificRestrictions = getSpecificRestrictions(extensionClass);
-
-        final boolean hasRestriction = restrictedDescription != null || !specificRestrictions.isEmpty();
-        final Restrictions restrictions;
-        if (!hasRestriction) {
-            return null;
-        }
-
-        final Set<Restriction> restrictionSet = new HashSet<>();
-        for (final Map.Entry<String, String> specificRestriction : specificRestrictions.entrySet()) {
-            restrictionSet.add(new StandardRestriction(specificRestriction.getKey(), specificRestriction.getValue()));
-        }
-
-        return new StandardRestrictions(restrictedDescription, restrictionSet);
-    }
-
-
-    private String getCapabilityDescription(final Class<?> extensionClass) throws InvocationTargetException,
-                IllegalAccessException, NoSuchMethodException, ClassNotFoundException {
-
-        final Class capabilityDescriptionClass = Class.forName("org.apache.nifi.annotation.documentation.CapabilityDescription", false, extensionClass.getClassLoader());
-        final Method valueMethod = capabilityDescriptionClass.getMethod("value");
-
-        final Annotation capabilityDescriptionAnnotation = extensionClass.getAnnotation(capabilityDescriptionClass);
-        if (capabilityDescriptionAnnotation == null) {
-            return null;
-        }
-
-        final String capabilityDescriptionText = (String) valueMethod.invoke(capabilityDescriptionAnnotation);
-        return capabilityDescriptionText;
-    }
-
-
-    private Set<String> getTags(final Class<?> extensionClass) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, ClassNotFoundException {
-        final Class tagsClass = Class.forName("org.apache.nifi.annotation.documentation.Tags", false, extensionClass.getClassLoader());
-        final Method valueMethod = tagsClass.getMethod("value");
-
-        final Annotation tagsAnnotation = extensionClass.getAnnotation(tagsClass);
-        if (tagsAnnotation == null) {
-            return Collections.emptySet();
-        }
-
-        final String[] tags = (String[]) valueMethod.invoke(tagsAnnotation);
-        return Stream.of(tags).collect(Collectors.<String>toSet());
-    }
-
-
-    private Map<String, String> getSpecificRestrictions(final Class<?> extensionClass) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, ClassNotFoundException {
-        final Class restrictedClass = Class.forName("org.apache.nifi.annotation.behavior.Restricted", false, extensionClass.getClassLoader());
-        final Class restrictionClass = Class.forName("org.apache.nifi.annotation.behavior.Restriction", false, extensionClass.getClassLoader());
-        final Class requiredPermissionClass = Class.forName("org.apache.nifi.components.RequiredPermission", false, extensionClass.getClassLoader());
-
-        final Method restrictionsMethod = restrictedClass.getMethod("restrictions");
-        final Method explanationMethod = restrictionClass.getMethod("explanation");
-        final Method requiredPermissionMethod = restrictionClass.getMethod("requiredPermission");
-        final Method getPermissionIdentifierMethod = requiredPermissionClass.getMethod("getPermissionIdentifier");
-
-        final Annotation restrictionAnnotation = restrictedClass.getAnnotation(restrictedClass);
-        if (restrictionAnnotation == null) {
-            return edu.emory.mathcs.backport.java.util.Collections.emptyMap();
-        }
-
-        final Object[] restrictionsArray = (Object[]) restrictionsMethod.invoke(restrictionAnnotation);
-
-        final Map<String, String> restrictions = new HashMap<>();
-        for (final Object restriction : restrictionsArray) {
-            final String explanation = (String) explanationMethod.invoke(restriction);
-
-            final Object requiredPermission = requiredPermissionMethod.invoke(restriction);
-            final String requiredPermissionId = (String) getPermissionIdentifierMethod.invoke(requiredPermission);
-
-            restrictions.put(requiredPermissionId, explanation);
-        }
-
-        return restrictions;
-    }
-
-    private String getRestrictedDescription(final Class<?> extensionClass) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException, ClassNotFoundException {
-        final Class restrictedClass = Class.forName("org.apache.nifi.annotation.behavior.Restricted", false, extensionClass.getClassLoader());
-        final Method valueMethod = restrictedClass.getMethod("value");
-
-        final Annotation restrictedAnnotation = extensionClass.getAnnotation(restrictedClass);
-        if (restrictedAnnotation == null) {
-            return null;
-        }
-
-        return (String) valueMethod.invoke(restrictedAnnotation);
-    }
-
-
-
     private Set<String> discoverClassNames(final String extensionType) throws IOException {
         final Set<String> classNames = new HashSet<>();
 
diff --git a/src/main/java/org/apache/nifi/extension/definition/extraction/StandardExtensionDefinition.java b/src/main/java/org/apache/nifi/extension/definition/extraction/StandardExtensionDefinition.java
index dadb747..fe19757 100644
--- a/src/main/java/org/apache/nifi/extension/definition/extraction/StandardExtensionDefinition.java
+++ b/src/main/java/org/apache/nifi/extension/definition/extraction/StandardExtensionDefinition.java
@@ -18,45 +18,23 @@ package org.apache.nifi.extension.definition.extraction;
 
 import org.apache.nifi.extension.definition.ExtensionDefinition;
 import org.apache.nifi.extension.definition.ExtensionType;
-import org.apache.nifi.extension.definition.Restrictions;
 import org.apache.nifi.extension.definition.ServiceAPIDefinition;
 
 import java.util.Set;
 
 public class StandardExtensionDefinition implements ExtensionDefinition {
-    private final String capabilityDescription;
-    private final Set<String> tags;
-    private final Restrictions restrictions;
+
     private final ExtensionType extensionType;
     private final String extensionName;
     private final Set<ServiceAPIDefinition> providedServiceApis;
 
-    public StandardExtensionDefinition(final ExtensionType extensionType, final String extensionName, final String capabilityDescription, final Set<String> tags, final Restrictions restrictions,
-                                       final Set<ServiceAPIDefinition> providedServiceApis) {
+    public StandardExtensionDefinition(final ExtensionType extensionType, final String extensionName, final Set<ServiceAPIDefinition> providedServiceApis) {
         this.extensionType = extensionType;
         this.extensionName = extensionName;
-        this.capabilityDescription = capabilityDescription;
-        this.tags = tags;
-        this.restrictions = restrictions;
         this.providedServiceApis = providedServiceApis;
     }
 
     @Override
-    public String getCapabilityDescription() {
-        return capabilityDescription;
-    }
-
-    @Override
-    public Set<String> getTags() {
-        return tags;
-    }
-
-    @Override
-    public Restrictions getRestrictions() {
-        return restrictions;
-    }
-
-    @Override
     public ExtensionType getExtensionType() {
         return extensionType;
     }
diff --git a/src/main/java/org/apache/nifi/extension/definition/extraction/StandardRestriction.java b/src/main/java/org/apache/nifi/extension/definition/extraction/StandardRestriction.java
deleted file mode 100644
index 6825d5b..0000000
--- a/src/main/java/org/apache/nifi/extension/definition/extraction/StandardRestriction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.extension.definition.extraction;
-
-import org.apache.nifi.extension.definition.Restriction;
-
-public class StandardRestriction implements Restriction {
-    private final String identifier;
-    private final String explanation;
-
-    public StandardRestriction(final String identifier, final String explanation) {
-        this.identifier = identifier;
-        this.explanation = explanation;
-    }
-
-    @Override
-    public String getIdentifier() {
-        return identifier;
-    }
-
-    @Override
-    public String getExplanation() {
-        return explanation;
-    }
-}
diff --git a/src/main/java/org/apache/nifi/extension/definition/extraction/StandardRestrictions.java b/src/main/java/org/apache/nifi/extension/definition/extraction/StandardRestrictions.java
deleted file mode 100644
index 97fa9ba..0000000
--- a/src/main/java/org/apache/nifi/extension/definition/extraction/StandardRestrictions.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nifi.extension.definition.extraction;
-
-import org.apache.nifi.extension.definition.Restriction;
-import org.apache.nifi.extension.definition.Restrictions;
-
-import java.util.Set;
-
-public class StandardRestrictions implements Restrictions {
-    private final String generalRestrictionExplanation;
-    private final Set<Restriction> restrictions;
-
-    public StandardRestrictions(final String generalRestrictionExplanation, final Set<Restriction> restrictions) {
-        this.generalRestrictionExplanation = generalRestrictionExplanation;
-        this.restrictions = restrictions;
-    }
-
-    @Override
-    public String getGeneralRestrictionExplanation() {
-        return generalRestrictionExplanation;
-    }
-
-    @Override
-    public Set<Restriction> getRestrictions() {
-        return restrictions;
-    }
-}