Reputation: 302
I am pretty new with Apache Nifi and NARs in general. I am creating a custom processor NAR project which needs to reference classes from the jars present in another NAR file. I don't have access to the project(source code) which has generated this NAR. So I am trying to include this NAR file as a maven dependency. This is similar to how you would add an external/local jar as a maven dependency. What would be the right way to achieve this?
NOTE: My custom project is a child project of "nifi-nar-bundles" so it will inherit the "nar-maven-plugin"
<parent>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-nar-bundles</artifactId>
<version>1.11.4</version>
</parent>
I am using eclipse with its maven plugin and have tried few things:
#1
<dependency>
<groupId>com.group.test</groupId>
<artifactId>test-nar</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<type>nar</type>
<systemPath>C:\test-nar-1.0.0.nar</systemPath>
</dependency>
This does not add the NAR file under "Maven Dependencies" in eclipse. However if I remove <type>nar</type>
it shows the NAR file under "Maven Dependencies" but does not put its jars in the classpath.
#2
I installed the NAR in my local maven repository with packaging as "nar" using below command:
mvn install:install-file -Dfile=test-nar-1.0.0.nar -DgroupId=com.group.test -DartifactId=test-nar -Dversion=1.0.0 -Dpackaging=nar
and then put it as a dependency in the pom.xml
file as below:
<dependency>
<groupId>com.group.test</groupId>
<artifactId>test-nar</artifactId>
<version>1.0.0</version>
<type>nar</type>
</dependency>
This does not add the NAR file under "Maven Dependencies" in eclipse either.
Upvotes: 1
Views: 929
Reputation: 12083
The test-nar dependency of type "nar" should be included in your NAR module, and if you can't bring in its dependencies to your code module (not your NAR module) as provided you might need to include the NAR itself as provided in your code module, in order to get the code module to compile. However the dependencies will be provided by the parent NAR (test-nar) at runtime.
Upvotes: 0