You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

创建NiFi自定义处理器时Maven依赖解析错误求助

解决NiFi 2.0.0-M2自定义处理器Maven依赖解析错误

问题核心原因

NiFi 2.0.0-M2作为里程碑预览版本,配套的nifi-standard-services-api-nar版本并非1.0-SNAPSHOT,但通过mvn archetype:generate生成的项目模板默认引用了错误的依赖版本,导致Maven无法在仓库中匹配到对应资源。

分步解决方案

  • 统一项目依赖版本
    打开项目根目录的pom.xml,先确认<properties>节点下的nifi.version值为2.0.0-M2,再找到所有引用nifi-standard-services-api-nar的依赖项,将版本替换为${nifi.version},示例配置:

    <dependency>
        <groupId>org.apache.nifi</groupId>
        <artifactId>nifi-standard-services-api-nar</artifactId>
        <version>${nifi.version}</version>
        <type>nar</type>
    </dependency>
    
  • 清理Maven本地缓存
    删除Windows本地仓库中错误版本的依赖目录:C:\Users\[你的用户名]\.m2\repository\org\apache\nifi\nifi-standard-services-api-nar\1.0-SNAPSHOT,删除后重新执行mvn clean install。

  • 配置Maven访问NiFi里程碑仓库
    检查Maven的settings.xml(路径:C:\Users\[你的用户名]\.m2\settings.xml),添加Apache里程碑仓库配置,确保Maven能拉取到NiFi预览版本依赖:

    <repositories>
        <repository>
            <id>apache-staging</id>
            <url>https://repository.apache.org/content/repositories/maven-staging/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    
  • 验证JDK编译兼容性
    在pom.xml的<properties>节点中添加或修改编译参数,适配JDK21:

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
    </properties>
    

内容的提问来源于stack exchange,提问作者Muon3948729348792

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 12:02:42