That project doesn't follow the expected NAR setup. Typically there is
a parent module with two child modules, one of the processors JAR and
one for the NAR. This project appears to bundle everything into one
module which I think is producing some unexpected behavior. The result
is that instead of the processors being inside a JAR which is then
inside the NAR, the actual Java code of the processors is directly in
the root of the NAR.

The expected project structure is described here:

https://cwiki.apache.org/confluence/display/NIFI/Maven+Projects+for+Extensions#MavenProjectsforExtensions-ExampleProcessorBundleStructure

If you use the Maven archetype described on that page you will get the
correct starting point.

On Tue, Aug 27, 2019 at 3:20 PM David Perkins <[email protected]> wrote:
>
> I grabbed an example out there to see if had the same behavior and it did.
>
> I forked it and just updated the nifi version and the nar plugin version.
> https://github.com/David-N-Perkins/nifi-examples
>
> On 2019/08/27 18:11:39, Bryan Bende <[email protected]> wrote:
> > Would you be able to provide an example repo that produces a NAR that
> > shows the problem?
> >
> > If not, I can point at places where you could look into, but you'll
> > likely need to attach a remote debugger to NiFi to see what is going
> > on.
> >
> > On Tue, Aug 27, 2019 at 1:46 PM David Perkins <[email protected]> 
> > wrote:
> > >
> > > Yes, I was able to view my component directly using the path under 
> > > work/docs.
> > >
> > > So, now we just need to figure out why it's not being added to the list 
> > > of processors.
> > >
> > > On 2019/08/27 16:11:43, Bryan Bende <[email protected]> wrote:
> > > > Here is one more thing to try...
> > > >
> > > > Since you said you do see the files generated in the work/docs
> > > > directory, those should be made available through a servlet which is
> > > > what the links on the left side of the docs page link to.
> > > >
> > > > For example, if I right-click on AttributeRollingWindow and open the
> > > > link in new tab, it goes to the following URL:
> > > >
> > > > http://localhost:8080/nifi-docs/components/org.apache.nifi/nifi-stateful-analysis-nar/1.10.0-SNAPSHOT/org.apache.nifi.processors.stateful.analysis.AttributeRollingWindow/index.html
> > > >
> > > > Are you able to navigate directly to your component using the same
> > > > path you found in work/docs ?
> > > >
> > > > On Tue, Aug 27, 2019 at 11:27 AM David Perkins
> > > > <[email protected]> wrote:
> > > > >
> > > > > I tried another browser just to make sure.  Same behavior.  I checked 
> > > > > the logs and didn't see any errors.  I found the messages where the 
> > > > > custom processors were being loaded.  Looked the same as all the 
> > > > > other logs about loading processors.
> > > > >
> > > > > On 2019/08/26 20:29:59, Bryan Bende <[email protected]> wrote:
> > > > > > Those files are generated when NiFi starts and loads all the NARs.
> > > > > >
> > > > > > Is it possible your browser has something cached and when you open 
> > > > > > the
> > > > > > docs page it isn't loading the most up to date version?
> > > > > >
> > > > > > On Mon, Aug 26, 2019 at 4:23 PM David Perkins 
> > > > > > <[email protected]> wrote:
> > > > > > >
> > > > > > > Correct.  When I open the documentation from within the 
> > > > > > > application, the list of the processors on the left hand side 
> > > > > > > does not include my processors.
> > > > > > >
> > > > > > > I checked and I do see files at the path you mentioned.  I 
> > > > > > > pointed my browser to one of them and it displayed it with all 
> > > > > > > the information I was expecting.  So the files are there, but not 
> > > > > > > being displayed in the application documentation.
> > > > > > >
> > > > > > > Question: How do the files located at 
> > > > > > > NIFI_HOME/work/docs/components/{group-id}/{artifact-id}/{version}/{component}/index.html,
> > > > > > >  get generated?  Is it when NiFi reads the nar files from the 
> > > > > > > extensions directory?  I was expecting them to be generated as 
> > > > > > > part of the build and included in the nar file.  I looked in the 
> > > > > > > nar and didn't find anything.
> > > > > > >
> > > > > > > On 2019/08/26 18:23:16, Bryan Bende <[email protected]> wrote:
> > > > > > > > So if you open the documentation from with in the application, 
> > > > > > > > the
> > > > > > > > list of the processors on the left hand side does not include 
> > > > > > > > your
> > > > > > > > processor?
> > > > > > > >
> > > > > > > > Is anything generated for your processor under
> > > > > > > > NIFI_HOME/work/docs/components/{group-id}/{artifact-id}/{version}/{component}/index.html
> > > > > > > > ?
> > > > > > > >
> > > > > > > > On Mon, Aug 26, 2019 at 1:54 PM David Perkins 
> > > > > > > > <[email protected]> wrote:
> > > > > > > > >
> > > > > > > > > Bryan,
> > > > > > > > >
> > > > > > > > > I do have many annotations on the Processor class.  The 
> > > > > > > > > problem is
> > > > > > > > > that documentation is not being generated automatically.  I 
> > > > > > > > > don't see
> > > > > > > > > any errors, so I have been unable to determine why it's not 
> > > > > > > > > being
> > > > > > > > > generated.  The processors appear in NiFi and I'm able to 
> > > > > > > > > search for
> > > > > > > > > them via the tags I specified.  It's just the documentation 
> > > > > > > > > that's not
> > > > > > > > > appearing.
> > > > > > > > >
> > > > > > > > > Thanks for the note on where to put the additional details 
> > > > > > > > > file.  That
> > > > > > > > > wasn't clear from the documentation.  I'll give it a try.
> > > > > > > > >
> > > > > > > > > David P.
> > > > > > > > >
> > > > > > > > > On 2019/08/26 15:21:12, Bryan Bende <[email protected]> wrote:
> > > > > > > > > > Hello,
> > > > > > > > > >
> > > > > > > > > > The documentation for a processor is generated 
> > > > > > > > > > automatically from the
> > > > > > > > > > annotations on the processors. If you used the Maven 
> > > > > > > > > > Archetype to
> > > > > > > > > > generate your NAR then you should already have a starting 
> > > > > > > > > > point for
> > > > > > > > > > this with the example MyProcessor which has the following 
> > > > > > > > > > annotations:
> > > > > > > > > >
> > > > > > > > > > @Tags({"example"})
> > > > > > > > > > @CapabilityDescription("Provide a description")
> > > > > > > > > > @SeeAlso({})
> > > > > > > > > > @ReadsAttributes({@ReadsAttribute(attribute="", 
> > > > > > > > > > description="")})
> > > > > > > > > > @WritesAttributes({@WritesAttribute(attribute="", 
> > > > > > > > > > description="")})
> > > > > > > > > >
> > > > > > > > > > For the additionalDetails.html, it may help you to look at 
> > > > > > > > > > how it is
> > > > > > > > > > setup in the existing NARs:
> > > > > > > > > >
> > > > > > > > > > https://github.com/apache/nifi/tree/master/nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-2-0-processors/src/main/resources/docs
> > > > > > > > > >
> > > > > > > > > > In the processors Maven module, the location would be
> > > > > > > > > > "src/main/resources/docs/{fully-qualified-component-name}/additionalDetails.html"
> > > > > > > > > >
> > > > > > > > > > On Fri, Aug 23, 2019 at 3:43 PM David Perkins 
> > > > > > > > > > <[email protected]> wrote:
> > > > > > > > > > >
> > > > > > > > > > > Hello,
> > > > > > > > > > >   I'm having trouble generating documentation for a set 
> > > > > > > > > > > of custom NiFi
> > > > > > > > > > > processors.  I posted a question with all the details 
> > > > > > > > > > > here on Stack
> > > > > > > > > > > Overflow.
> > > > > > > > > > > https://stackoverflow.com/questions/57530465/how-to-generate-usage-documentation-for-custom-processors
> > > > > > > > > > >
> > > > > > > > > > > Below is a copy of what I posted.  Thanks for any help 
> > > > > > > > > > > with this.
> > > > > > > > > > >
> > > > > > > > > > > David P.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > I have created several custom NiFi processors, but have 
> > > > > > > > > > > been unable to
> > > > > > > > > > > get usage documentation to be generated. 'Usage' 
> > > > > > > > > > > documentation refers
> > > > > > > > > > > to right clicking on a processor and selecting 'Usage', 
> > > > > > > > > > > which should
> > > > > > > > > > > bring up documentation about that specific processor. The
> > > > > > > > > > > documentation panel is displayed, but none of my custom 
> > > > > > > > > > > processors are
> > > > > > > > > > > present.
> > > > > > > > > > >
> > > > > > > > > > > I used several NiFi documentation tags on my custom 
> > > > > > > > > > > processor classes
> > > > > > > > > > > including several Read/Written attributes. The code 
> > > > > > > > > > > compiles and unit
> > > > > > > > > > > tests without any issues. The build reports
> > > > > > > > > > >
> > > > > > > > > > > [INFO] Generating documentation for NiFi extensions in 
> > > > > > > > > > > the NAR...
> > > > > > > > > > >
> > > > > > > > > > > According to the developer guide documentation is 
> > > > > > > > > > > supposed to
> > > > > > > > > > > automatically be generated.
> > > > > > > > > > >
> > > > > > > > > > > I also tried creating an additionalDetails.html file and 
> > > > > > > > > > > putting it in
> > > > > > > > > > > the nar according the documentation.
> > > > > > > > > > >
> > > > > > > > > > > This file should exist within a directory whose name is 
> > > > > > > > > > > the
> > > > > > > > > > > fully-qualified name of the Processor, and this 
> > > > > > > > > > > directory’s parent
> > > > > > > > > > > should be named docs and exist in the root of the 
> > > > > > > > > > > Processor’s jar.
> > > > > > > > > > >
> > > > > > > > > > > However, that broke NiFi and I found this in the logs.
> > > > > > > > > > >
> > > > > > > > > > >         === End Processor types ===
> > > > > > > > > > > 2019-08-16 15:16:36,100 WARN [main]
> > > > > > > > > > > org.apache.nifi.web.server.JettyServer Failed to start 
> > > > > > > > > > > web server...
> > > > > > > > > > > shutting down.
> > > > > > > > > > > java.lang.NullPointerException: null
> > > > > > > > > > >         at 
> > > > > > > > > > > org.apache.nifi.documentation.DocGenerator.generate(DocGenerator.java:62)
> > > > > > > > > > >         at 
> > > > > > > > > > > org.apache.nifi.web.server.JettyServer.start(JettyServer.java:932)
> > > > > > > > > > >         at org.apache.nifi.NiFi.<init>(NiFi.java:158)
> > > > > > > > > > >         at org.apache.nifi.NiFi.<init>(NiFi.java:72)
> > > > > > > > > > >         at org.apache.nifi.NiFi.main(NiFi.java:297)
> > > > > > > > > > > 2019-08-16 15:16:36,100 INFO [Thread-1] 
> > > > > > > > > > > org.apache.nifi.NiFi
> > > > > > > > > > > Initiating shutdown of Jetty web server...
> > > > > > > > > > >
> > > > > > > > > > > I'm using the standard nifi-nar-maven-plugin to generate 
> > > > > > > > > > > the nar file.
> > > > > > > > > > > Here's a snippet of my pom.xmlfile.
> > > > > > > > > > >
> > > > > > > > > > > <project xmlns="http://maven.apache.org/POM/4.0.0";
> > > > > > > > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > > > > > > > > > >   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > > > > > > > > > > http://maven.apache.org/maven-v4_0_0.xsd";>;
> > > > > > > > > > >   <modelVersion>4.0.0</modelVersion>
> > > > > > > > > > >   <groupId>com.myorg</groupId>
> > > > > > > > > > >   <artifactId>nifi-mylib</artifactId>
> > > > > > > > > > >   <packaging>nar</packaging>
> > > > > > > > > > >   <version>0.0.3</version>
> > > > > > > > > > >   <name>nifi-mylib</name>
> > > > > > > > > > >
> > > > > > > > > > >   <properties>
> > > > > > > > > > >       
> > > > > > > > > > > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> > > > > > > > > > >       <maven.compiler.source>1.8</maven.compiler.source>
> > > > > > > > > > >       <maven.compiler.target>1.8</maven.compiler.target>
> > > > > > > > > > >       <nifi.version>1.9.2</nifi.version>
> > > > > > > > > > >   </properties>
> > > > > > > > > > >
> > > > > > > > > > >   <dependencies>
> > > > > > > > > > >       <dependency>
> > > > > > > > > > >           <groupId>org.apache.nifi</groupId>
> > > > > > > > > > >           <artifactId>nifi-api</artifactId>
> > > > > > > > > > >           <version>${nifi.version}</version>
> > > > > > > > > > >       </dependency>
> > > > > > > > > > >       ...
> > > > > > > > > > >   </dependencies>
> > > > > > > > > > >
> > > > > > > > > > >   <build>
> > > > > > > > > > >       <plugins>
> > > > > > > > > > >           <plugin>
> > > > > > > > > > >               <groupId>org.apache.nifi</groupId>
> > > > > > > > > > >               
> > > > > > > > > > > <artifactId>nifi-nar-maven-plugin</artifactId>
> > > > > > > > > > >               <version>1.3.1</version>
> > > > > > > > > > >               <extensions>true</extensions>
> > > > > > > > > > >           </plugin>
> > > > > > > > > > >           <plugin>
> > > > > > > > > > >               <groupId>org.apache.maven.plugins</groupId>
> > > > > > > > > > >               
> > > > > > > > > > > <artifactId>maven-surefire-plugin</artifactId>
> > > > > > > > > > >               <version>2.15</version>
> > > > > > > > > > >           </plugin>
> > > > > > > > > > >       </plugins>
> > > > > > > > > > >   </build>
> > > > > > > > > > > </project>
> > > > > > > > > > >
> > > > > > > > > > > The generated .nar (without the additionalDetails.html 
> > > > > > > > > > > file) load
> > > > > > > > > > > correctly and appear in the list of processors. It's just 
> > > > > > > > > > > the Usage
> > > > > > > > > > > documentation that I can't get to work.
> > > > > > > > > >
> > > > > > > >
> > > > > >
> > > >
> >

Reply via email to