简体   繁体   中英

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

I am trying to build a nar file from maven repo central. I am not very used to maven, so I will explain the steps I followed until the blocking point where I am stuck now.

I want to generate the nar files for this artifact:

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

So I created this pom.xml file:

<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):

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:

[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 )

Thank you

You would need to get the source code for Apache NiFi version 1.10.0 and then build that module.

You could get the code by cloning the git repo and checking out the tag 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

Then run mvn clean package from the location above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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