我正在尝试创建一个新的 Nifi 定制处理器。
我正在遵循 4 个不同教程中给出的说明。
我只创建处理器的结构,我什至不尝试修改
代码和我总是有相同的 mvn clean install [错误]。
你能帮我解决这个问题吗?
非常感谢!!!
操作系统:Windows 10 家庭版
Nifi版本:2.0.0-M2
Maven:Apache Maven 3.9.6
JDK :Java 版本:21.0.2,供应商:Oracle Corporation,运行时:C:\Program Files\Java\jdk-21
我的版本:Java 和 Maven newbi (0.0.1)
Maven 已安装,我已将其 bin 添加到路径环境变量中。
Jdk 已安装,我已将其 bin 添加到路径环境变量中。
JAVA_HOME env var 定义为 C:\Program Files\Java\jdk-21,我的 jdk 安装在其中。
错误:
[ERROR] Failed to execute goal on project nifi-helloworld-nar: Could not resolve dependencies for project org.apache.nifi:nifi-helloworld-nar:nar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.apache.nifi:nifi-standard-services-api-nar:nar:1.0-SNAPSHOT (absent): org.apache.nifi:nifi-standard-services-api-nar:nar:1.0-SNAPSHOT was not found in https://repository.apache.org/snapshots during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of apache.snapshots has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :nifi-helloworld-nar
我尝试过的:
我已经阅读了几个教程(4)来创建这样的处理器,它们都告诉
mvn 原型:生成
cd 创建的文件夹
mvn 干净安装
我尝试过 mvn clean install -e -X swicthes 来尝试看看我是否能理解任何明显的错误......
我只包含了没有 -e -X 的日志,不想在这里放置太多信息......
我可能没有定义所需的环境变量或其他东西......
我用来(尝试)创建自定义处理器的命令:
mvn 原型:生成
选择一个数字或应用过滤器(格式:[groupId:]artifactId,区分大小写包含):2104:nifi
类型处理器:1
选择 org.apache.nifi:nifi-processor-bundle-archetype 版本:67:67 = 2.0.0-M2
定义属性“artifactBaseName”的值:helloworld
定义属性“groupId”的值:org.apache.nifi
定义属性“artifactId”的值:nifi-helloworld-bundle
定义属性“版本”1.0-SNAPSHOT 的值::
定义属性“package”的值 org.apache.nifi.processors.helloworld: :
确认属性配置:
工件基本名称:helloworld
nifi版本:2.0.0-M2
组ID:org.apache.nifi
artifactId:nifi-helloworld-bundle
版本:1.0-快照
包:org.apache.nifi.processors.helloworld
是: : 是
cd nifi-helloworld-bundle
mvn 全新安装
这些命令的日志:
C:\Users\ASUS\Desktop\nifi-custom-processor>mvn archetype:generate
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] >>> archetype:3.2.1:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO]
[INFO] <<< archetype:3.2.1:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO]
[INFO]
[INFO] --- archetype:3.2.1:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> am.ik.archetype:elm-spring-boot-blank-archetype (Blank multi project for Spring Boot + Elm)
2: remote -> am.ik.archetype:graalvm-blank-archetype (Blank project for GraalVM)
3: remote -> am.ik.archetype:graalvm-springmvc-blank-archetype (Blank project for GraalVM + Spring MVC)
.
.
.
3356: remote -> za.co.absa.hyperdrive:component-archetype_2.11 (-)
3357: remote -> za.co.absa.hyperdrive:component-archetype_2.12 (-)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 2104: nifi
Choose archetype:
1: remote -> org.apache.nifi:nifi-processor-bundle-archetype (-)
2: remote -> org.apache.nifi:nifi-service-bundle-archetype (-)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose org.apache.nifi:nifi-processor-bundle-archetype version:
1: 0.0.2-incubating
2: 0.1.0-incubating
3: 0.2.0-incubating
.
.
.
64: 1.24.0
65: 1.25.0
66: 2.0.0-M1
67: 2.0.0-M2
Choose a number: 67:
Define value for property 'artifactBaseName': helloworld
[INFO] Using property: nifiVersion = 2.0.0-M2
Define value for property 'groupId': org.apache.nifi
Define value for property 'artifactId': nifi-helloworld-bundle
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' org.apache.nifi.processors.helloworld: :
Confirm properties configuration:
artifactBaseName: helloworld
nifiVersion: 2.0.0-M2
groupId: org.apache.nifi
artifactId: nifi-helloworld-bundle
version: 1.0-SNAPSHOT
package: org.apache.nifi.processors.helloworld
Y: : Y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: nifi-processor-bundle-archetype:2.0.0-M2
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.apache.nifi
[INFO] Parameter: artifactId, Value: nifi-helloworld-bundle
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: org.apache.nifi.processors.helloworld
[INFO] Parameter: packageInPathFormat, Value: org/apache/nifi/processors/helloworld
[INFO] Parameter: package, Value: org.apache.nifi.processors.helloworld
[INFO] Parameter: artifactBaseName, Value: helloworld
[INFO] Parameter: groupId, Value: org.apache.nifi
[INFO] Parameter: artifactId, Value: nifi-helloworld-bundle
[INFO] Parameter: nifiVersion, Value: 2.0.0-M2
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[WARNING] Don't override file C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\nifi-helloworld-processors
[WARNING] Don't override file C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\nifi-helloworld-processors\src\main\java\org\apache\nifi\processors\helloworld
[WARNING] Don't override file C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\nifi-helloworld-processors\src\test\java\org\apache\nifi\processors\helloworld
[WARNING] Don't override file C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\nifi-helloworld-nar
[INFO] Project created from Archetype in dir: C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:20 min
[INFO] Finished at: 2024-02-20T11:08:03-05:00
[INFO] ------------------------------------------------------------------------
C:\Users\ASUS\Desktop\nifi-custom-processor>dir
2024-02-20 11:08 AM <DIR> .
2024-02-20 11:08 AM <DIR> ..
2024-02-20 11:08 AM <DIR> nifi-helloworld-bundle
C:\Users\ASUS\Desktop\nifi-custom-processor>cd nifi-helloworld-bundle
C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle>mvn clean install
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 3 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 3 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] nifi-helloworld-bundle [pom]
[INFO] nifi-helloworld-processors [jar]
[INFO] nifi-helloworld-nar [nar]
[INFO]
[INFO] ---------------< org.apache.nifi:nifi-helloworld-bundle >---------------
[INFO] Building nifi-helloworld-bundle 1.0-SNAPSHOT [1/3]
[INFO] from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- clean:3.3.2:clean (default-clean) @ nifi-helloworld-bundle ---
[INFO]
[INFO] --- enforcer:3.4.1:enforce (enforce-maven-version) @ nifi-helloworld-bundle ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.BanDuplicatePomDependencyVersions passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.RequireSameVersions passed
[INFO] Rule 2: org.apache.maven.enforcer.rules.version.RequireMavenVersion passed
[INFO] Rule 3: org.apache.maven.enforcer.rules.dependency.RequireReleaseDeps passed
[INFO] Rule 4: org.apache.maven.enforcer.rules.dependency.BannedDependencies passed
[INFO]
[INFO] --- enforcer:3.4.1:enforce (enforce-java-version) @ nifi-helloworld-bundle ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.version.RequireJavaVersion passed
[INFO]
[INFO] --- buildnumber:3.2.0:create (default) @ nifi-helloworld-bundle ---
[INFO]
[INFO] --- remote-resources:3.1.0:process (process-resource-bundles) @ nifi-helloworld-bundle ---
[INFO] Preparing remote bundle org.apache.apache.resources:apache-jar-resource-bundle:1.5
[INFO] Copying 3 resources from 1 bundle.
[INFO]
[INFO] --- site:3.12.1:attach-descriptor (attach-descriptor) @ nifi-helloworld-bundle ---
[INFO] No site descriptor found: nothing to attach.
[INFO]
[INFO] --- install:3.1.1:install (default-install) @ nifi-helloworld-bundle ---
[INFO] Installing C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\pom.xml to C:\Users\ASUS\.m2\repository\org\apache\nifi\nifi-helloworld-bundle\1.0-SNAPSHOT\nifi-helloworld-bundle-1.0-SNAPSHOT.pom
[INFO]
[INFO] -------------< org.apache.nifi:nifi-helloworld-processors >-------------
[INFO] Building nifi-helloworld-processors 1.0-SNAPSHOT [2/3]
[INFO] from nifi-helloworld-processors\pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.3.2:clean (default-clean) @ nifi-helloworld-processors ---
[INFO]
[INFO] --- enforcer:3.4.1:enforce (enforce-maven-version) @ nifi-helloworld-processors ---
[INFO] Rule 0: org.apache.maven.enforcer.rules.BanDuplicatePomDependencyVersions passed
[INFO] Rule 1: org.apache.maven.enforcer.rules.RequireSameVersions passed
[INFO] Rule 3: org.apache.maven.enforcer.rules.dependency.RequireReleaseDeps passed
[INFO] Rule 4: org.apache.maven.enforcer.rules.dependency.BannedDependencies passed
[INFO]
[INFO] --- enforcer:3.4.1:enforce (enforce-java-version) @ nifi-helloworld-processors ---
[INFO]
[INFO] --- buildnumber:3.2.0:create (default) @ nifi-helloworld-processors ---
[INFO]
[INFO] --- remote-resources:3.1.0:process (process-resource-bundles) @ nifi-helloworld-processors ---
[INFO] Preparing remote bundle org.apache.apache.resources:apache-jar-resource-bundle:1.5
[INFO] Copying 3 resources from 1 bundle.
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ nifi-helloworld-processors ---
[INFO] Copying 1 resource from src\main\resources to target\classes
[INFO] Copying 3 resources from target\maven-shared-archive-resources to target\classes
[INFO]
[INFO] --- compiler:3.11.0:compile (default-compile) @ nifi-helloworld-processors ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 1 source file with javac [forked debug deprecation release 21] to target\classes
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ nifi-helloworld-processors ---
[INFO] skip non existing resourceDirectory C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\nifi-helloworld-processors\src\test\resources
[INFO] Copying 3 resources from target\maven-shared-archive-resources to target\test-classes
[INFO]
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ nifi-helloworld-processors ---
[INFO] Changes detected - recompiling the module! :dependency
[INFO] Compiling 1 source file with javac [forked debug deprecation release 21] to target\test-classes
[INFO]
[INFO] --- surefire:3.1.2:test (default-test) @ nifi-helloworld-processors ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.nifi.processors.helloworld.MyProcessorTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.139 s -- in org.apache.nifi.processors.helloworld.MyProcessorTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jar:3.3.0:jar (default-jar) @ nifi-helloworld-processors ---
[INFO] Building jar: C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\nifi-helloworld-processors\target\nifi-helloworld-processors-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- site:3.12.1:attach-descriptor (attach-descriptor) @ nifi-helloworld-processors ---
[INFO] Skipping because packaging 'jar' is not pom.
[INFO]
[INFO] --- install:3.1.1:install (default-install) @ nifi-helloworld-processors ---
[INFO] Installing C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\nifi-helloworld-processors\pom.xml to C:\Users\ASUS\.m2\repository\org\apache\nifi\nifi-helloworld-processors\1.0-SNAPSHOT\nifi-helloworld-processors-1.0-SNAPSHOT.pom
[INFO] Installing C:\Users\ASUS\Desktop\nifi-custom-processor\nifi-helloworld-bundle\nifi-helloworld-processors\target\nifi-helloworld-processors-1.0-SNAPSHOT.jar to C:\Users\ASUS\.m2\repository\org\apache\nifi\nifi-helloworld-processors\1.0-SNAPSHOT\nifi-helloworld-processors-1.0-SNAPSHOT.jar
[INFO]
[INFO] ----------------< org.apache.nifi:nifi-helloworld-nar >-----------------
[INFO] Building nifi-helloworld-nar 1.0-SNAPSHOT [3/3]
[INFO] from nifi-helloworld-nar\pom.xml
[INFO] --------------------------------[ nar ]---------------------------------
[WARNING] The POM for org.apache.nifi:nifi-standard-services-api-nar:nar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for nifi-helloworld-bundle 1.0-SNAPSHOT:
[INFO]
[INFO] nifi-helloworld-bundle ............................. SUCCESS [ 1.669 s]
[INFO] nifi-helloworld-processors ......................... SUCCESS [ 3.124 s]
[INFO] nifi-helloworld-nar ................................ FAILURE [ 0.036 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.222 s
[INFO] Finished at: 2024-02-20T11:08:59-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project nifi-helloworld-nar: Could not resolve dependencies for project org.apache.nifi:nifi-helloworld-nar:nar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.apache.nifi:nifi-standard-services-api-nar:nar:1.0-SNAPSHOT (absent): org.apache.nifi:nifi-standard-services-api-nar:nar:1.0-SNAPSHOT was not found in https://repository.apache.org/snapshots during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of apache.snapshots has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :nifi-helloworld-nar
这是正确的地方,因为开发自定义处理器就是编程。我认为这是一个错误,我正在研究它。看起来它正在使用您的
1.0-SNAPSHOT
版本来实现 NiFi 依赖项,而它应该使用 nifiVersion
。为了让事情顺利进行,请暂时使用 2.0.0-M2 作为您的 version
,然后您可以返回 helloworld 模块并将版本更改回您想要的版本。