maven 用于引用控制器服务的多个NAR依赖项

vlju58qv  于 2023-06-05  发布在  Maven
关注(0)|答案(1)|浏览(143)

我正在开发一个定制处理器,它同时使用DBCPServiceRecordReader
对于maven项目,我不能添加两个服务的NAR依赖项,因为这会导致错误。
对于我的处理器模块pom.xml,

<dependencies>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-utils</artifactId>
            <version>1.12.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-mock</artifactId>
            <version>1.12.0</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.apache.nifi</groupId>
            <artifactId>nifi-dbcp-service-api</artifactId>
            <version>1.12.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-record-serialization-service-api</artifactId>
            <version>1.12.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-record</artifactId>
            <version>1.12.0</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

我的处理器子模块

<dependencies>
        <dependency>
            <groupId>com.suntecgroup.xelerate</groupId>
            <artifactId>nifi-record-processors</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-record-serialization-services-nar</artifactId>
            <version>1.12.0</version>
            <type>nar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-dbcp-service-nar</artifactId>
            <version>1.12.0</version>
            <type>nar</type>
        </dependency>
    </dependencies>

如何将两个控制器服务的依赖项添加到处理器中呢?

krugob8w

krugob8w1#

NAR依赖项应该在包含服务API的NAR上,而不是在包含这些API的实现的NAR上。对于你的例子,nifi-dbcp-service-apinifi-record-serialization-service-api都是nifi-standard-services-api-nar的一部分,所以你只需要这个:

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

相关问题