Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

mvn archetype:generate -DarchetypeGroupId=org.apache.nifi -DarchetypeArtifactId=nifi-processor-bundle-archetype -DarchetypeVersion=1.011.04 -DnifiVersion=1.011.04

The archetypeVersion corresponds to the version of the nifi-processor-bundle-archetype that is being used, currently this version is the same as the top-level NiFi version (i.e. for the NiFi 0.7.0 release, the archetypeVersion would be 0.7.0, and so on). The nifiVersion is the version of NiFi that the new processors will depend on.

...

Running the above command will prompt you for the following properties:

PropertyDescription
groupIdThe Maven groupId for the new bundle.
artifactIdThe Maven artifactId for the new bundle. Generally something like "nifi-basename-bundle", where basename is specific to your bundle.
versionThe Maven version for the new bundle.
artifactBaseName

The base name from the artifactId. For example, to create a helloworld bundle, the artifactBaseName would be helloworld, and the artifactId would be nifi-helloworld-bundle.

packageThe Java package for the processors.

Example Processor Bundle Structure

...

mvn archetype:generate -DarchetypeGroupId=org.apache.nifi -DarchetypeArtifactId=nifi-service-bundle-archetype -DarchetypeVersion=1.011.04 -DnifiVersion=1.011.04

The archetypeVersion corresponds to the version of the nifi-service-bundle-archetype that is being used, currently this version is the same as the top-level NiFi version (i.e. for the NiFi 0.7.0 release, the archetypeVersion would be 0.7.0, and so on). The nifiVersion is the version of NiFi that the new controller service will depend on.

Running the above command will prompt you for the following properties:

PropertyDescription
groupIdThe Maven groupId for the new bundle.
artifactIdThe Maven artifactId for the new bundle. Generally something like "nifi-something-services", where "something" is specific to your bundle.
versionThe Maven version for the new bundle.
artifactBaseName

The base name from the artifactId. For example, to create a nifi-helloworld-services bundle, the artifactBaseName would be helloworld-service, and the artifactId would be nifi-helloworld-services.

packageThe Java package for the services and API.

Example Controller Service Structure

...

nifi-example-services
├── nifi-example-service
│   ├── pom.xml
│   └── src
│       ├── main/java
│       │   │   └── org.apache.nifi.example.service
│       │   │       └── StandardMyService.java
│       │   └── resources
│       │       └── META-INF
│       │           └── services
│       │               └── org.apache.nifi.controller.ControllerService
│       └── test/java
│               └── org.apache.nifi.example.service
│                   ├── TestProcessor.java
│                   └── TestStandardMyService.java
├── nifi-example-service-api
│   ├── pom.xml
│   └── src
│       └── main/java
│           └── org.apache.nifi.example.service
│               └── MyService.java
├── nifi-example-service-api-nar
│   └── pom.xml
├── nifi-example-service-nar
│   └── pom.xml
└── pom.xml

...


The dependency relationship between these projects is the following:

...

<dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-ssl-context-service-api</artifactId>
            <version>1.011.0<4</version>
            <scope>provided</scope>
</dependency>

...

<dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-standard-services-api-nar</artifactId>
            <version>1.011.0<4</version>
            <type>nar</type>
</dependency>

...

  1. Remove the <parent>...</parent> from the bundle's root pom, or replace it with another desired parent

  2. Add the nar plugin to bundle's root pom (ensure the latest version of the nar plugin is being used):

    <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.nifi</groupId>
                    <artifactId>nifi-nar-maven-plugin</artifactId>
                    <version>1.13.0<1</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </build>
     


  3. Specify the necessary dependency versions in the bundle's processor or service pom. This is required because the default behavior is for the dependencies to inherit their versions through the nifi-nar-bundle parent, so with a different parent these versions will have to be explicitly set. In addition, the nifi-nar-bundle parent normally sets the nifi-api dependency to provided, so this should be explicitly set in the processors pom.

...