[英]Custom Nifi processor throwing build error : Null Pointer Exception from Nifi nar maven plugin
[英]How to build nifi processor nar file and dependencies from maven central
我正在尝试从 maven repo central 构建一个 nar 文件。 我不是很习惯maven,所以我会解释我遵循的步骤,直到我现在卡住的阻塞点。
我想为这个工件生成 nar 文件:
https://mvnrepository.com/artifact/org.apache.nifi/nifi-hwx-schema-registry-nar/1.10.0
所以我创建了这个pom.xml
文件:
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>TestMaven</groupId>
<artifactId>TestMaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-hwx-schema-registry-nar</artifactId>
<version>1.10.0</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<artifactItems>
<artifactItem>
<!-- hardcode values, or use properties, depending on what you want
to do -->
<groupId>TestMaven</groupId>
<artifactId>TestMaven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>[ packaging ]</type>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
然后我尝试编译这个命令(第一个命令是在 PATH 上包含 maven 依赖项):
export JAVA_HOME=/usr/jdk64/jdk1.8.0_112
export M2_HOME=/usr/local/apache-maven
export M2=$M2_HOME/bin export PATH=$M2:$PATH
mvn -U -X dependency:copy-dependencies -DskipTests
-Dclassifier=sources -DoutputDirectory=target -Dhttp.proxyHost=X.X.X.X -Dhttp.proxyPort=80 -Dhttps.proxyHost=X.X.X.X -Dhttps.proxyPort=80
我收到此错误,表示找不到 maven 依赖项:
[错误] 无法在项目 TestMaven 上执行目标:无法解析项目 TestMaven:TestMaven:jar:0.0.1-SNAPSHOT: 找不到工件 org.apache.nifi:nifi-hwx-schema-registry-nar:jar 的依赖项:1.10.0 在中央 ( https://repo.maven.apache.org/maven2 ) -> [帮助 1] org.apache.maven.lifecycle.LifecycleExecutionException: 无法在项目 TestMaven 上执行目标: 无法解决依赖关系项目 TestMaven:TestMaven:jar:0.0.1-SNAPSHOT: 找不到工件 org.apache.nifi:nifi-hwx-schema-registry-nar:jar:1.10.0 在中央 ( https://repo.maven.apache .org/maven2 )
谢谢
您需要获取 Apache NiFi 1.10.0 版的源代码,然后构建该模块。
您可以通过克隆 git repo 并签出标签 rel/1.10.0 来获取代码。
然后从上面的位置运行mvn clean package
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.