Reputation: 137
I've written a Custom Processor to handle Multipart Posts in advance of this being introduced in 1.12. The processor and nar that I have work fine, but the nar bundle has introduced duplicates of a lot of the standard processors with a version number matching that of my Custom Processor.
This started to happen after I introduced the SSLContextService controller. Adding the Controller service required the addition of
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-standard-services-api-nar</artifactId>
<version>1.11.4</version>
<type>nar</type>
</dependency>
As per the guide on the apache nifi wiki, but the completed nar seems to contain "2.1.1-SNAPSHOT" version of standard nifi processors such as AttributesToJson or PutRecord and dozens of others.
Excluding this dependency causes the nar build to fail as the SSLContexService class is missing. Using a provided scope builds a nar of approximately the same size, which then causes NiFi to fail to start (so far I haven't found an error message telling my why, it just dies at startup).
Does anyone know how to stop these duplicates being created? The whole nar pom is;
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jontia</groupId>
<artifactId>PostMultipartFormData</artifactId>
<version>2.1.1-SNAPSHOT</version>
</parent>
<artifactId>nifi-multipart-nar</artifactId>
<version>2.1.1-SNAPSHOT</version>
<packaging>nar</packaging>
<properties>
<maven.javadoc.skip>true</maven.javadoc.skip>
<source.skip>true</source.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.jontia</groupId>
<artifactId>nifi-multipart-processors</artifactId>
<version>2.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-standard-services-api-nar</artifactId>
<version>1.11.4</version>
<type>nar</type>
</dependency>
</dependencies>
</project>
Processor Pom;
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jontia</groupId>
<artifactId>PostMultipartFormData</artifactId>
<version>2.1.1-SNAPSHOT</version>
</parent>
<artifactId>nifi-multipart-processors</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-utils</artifactId>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-ssl-context-service-api</artifactId>
<version>1.11.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-proxy-configuration-api</artifactId>
<version>1.11.4</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.nifi/nifi-processor-utils -->
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-processor-utils</artifactId>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-standard-processors</artifactId>
<version>1.11.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.9</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.12</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-mock</artifactId>
<version>1.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
</dependencies>
</project>
Upvotes: 1
Views: 722
Reputation: 18630
The processors pom.xml has a dependency on nifi-standard-processors:
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-standard-processors</artifactId>
<version>1.11.4</version>
</dependency>
So when your NAR is built it pulls in the JAR of the standard processors so now they are all bundled again in your NAR and also in the standard NAR.
You should not depend on standard processors. If there is some code in there that you need then it should be refactored into some type of reusable common module, or if you are trying to extend a processor you should really just copy it into your NAR and make whatever modifications are needed.
Upvotes: 5