简体   繁体   English

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

[英]How to build nifi processor nar file and dependencies from maven central

I am trying to build a nar file from maven repo central.我正在尝试从 maven repo central 构建一个 nar 文件。 I am not very used to maven, so I will explain the steps I followed until the blocking point where I am stuck now.我不是很习惯maven,所以我会解释我遵循的步骤,直到我现在卡住的阻塞点。

I want to generate the nar files for this artifact:我想为这个工件生成 nar 文件:

https://mvnrepository.com/artifact/org.apache.nifi/nifi-hwx-schema-registry-nar/1.10.0 https://mvnrepository.com/artifact/org.apache.nifi/nifi-hwx-schema-registry-nar/1.10.0

So I created this pom.xml file:所以我创建了这个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>

And then I try to compile whit this commands (first commands are to include maven dependencies on the PATH):然后我尝试编译这个命令(第一个命令是在 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

And I am getting this error, which says that the maven dependency couldn't be found:我收到此错误,表示找不到 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 ) [错误] 无法在项目 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 )

Thank you谢谢

You would need to get the source code for Apache NiFi version 1.10.0 and then build that module.您需要获取 Apache NiFi 1.10.0 版的源代码,然后构建该模块。

You could get the code by cloning the git repo and checking out the tag rel/1.10.0.您可以通过克隆 git repo 并签出标签 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 https://github.com/apache/nifi/tree/rel/nifi-1.10.0/nifi-nar-bundles/nifi-standard-services/nifi-hwx-schema-registry-bundle

Then run mvn clean package from the location above.然后从上面的位置运行mvn clean package

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM