java - 如何从 maven Central 构建 nifi 处理器 nar 文件和依赖项

标签 java maven apache-nifi

我正在尝试从 maven repo central 构建一个 nar 文件。我不太习惯 maven,所以我将解释我遵循的步骤,直到我现在卡住的阻塞点。

我想为此 Artifact 生成 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 依赖项:

[ERROR] Failed to execute goal on project TestMaven: Could not resolve dependencies for project TestMaven:TestMaven:jar:0.0.1-SNAPSHOT: Could not find artifact org.apache.nifi:nifi-hwx-schema-registry-nar:jar:1.10.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project TestMaven: Could not resolve dependencies for project TestMaven:TestMaven:jar:0.0.1-SNAPSHOT: Could not find artifact org.apache.nifi:nifi-hwx-schema-registry-nar:jar:1.10.0 in central (https://repo.maven.apache.org/maven2)



谢谢

最佳答案

您需要获取 Apache NiFi 版本 1.10.0 的源代码,然后构建该模块。

您可以通过克隆 git 存储库并查看标签 rel/1.10.0 来获取代码。

https://github.com/apache/nifi/tree/rel/nifi-1.10.0/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle

然后运行 ​​mvn clean package从上面的位置。

关于java - 如何从 maven Central 构建 nifi 处理器 nar 文件和依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59765634/

相关文章:

apache-nifi - Nifi(HDF)中的 Multi-Tenancy ?

apache-nifi - Apache Nifi GetFTP 处理器动态输入

java - 语句和PreparedStatement的区别

java - 从 Java 程序中存储/读取敏感数据

java - 如何在 JPA 存储库中创建优先查询

java - New Relic Heroku Java 安装失败

java - OGraphDatabase ClassNotFoundException OrientDB 1.7.8

java - 使用 mvn sonar :sonar ignores sonar-project. 属性运行 Sonar 分析

storage - NiFi如何将流数据存储在内存或磁盘中

java - 如何将 Java List 传递给 Scala,在 Scala 中对其进行过滤并返回给 Java?